Skip to content

Commit

Permalink
[MIG] fieldservice_portal: Migration to 15.0
Browse files Browse the repository at this point in the history
  • Loading branch information
anusriNPS authored and ppyczko committed Dec 12, 2024
1 parent 070314c commit a770f0c
Show file tree
Hide file tree
Showing 11 changed files with 264 additions and 55 deletions.
23 changes: 13 additions & 10 deletions fieldservice_portal/README.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
============================
Field Service - Order Portal
============================
======================
Field Service - Portal
======================

..
..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
Expand All @@ -17,13 +17,13 @@ Field Service - Order Portal
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Ffield--service-lightgray.png?logo=github
:target: https://github.com/OCA/field-service/tree/14.0/fieldservice_portal
:target: https://github.com/OCA/field-service/tree/15.0/fieldservice_portal
:alt: OCA/field-service
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/field-service-14-0/field-service-14-0-fieldservice_portal
:target: https://translation.odoo-community.org/projects/field-service-15-0/field-service-15-0-fieldservice_portal
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/field-service&target_branch=14.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/field-service&target_branch=15.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand All @@ -42,7 +42,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/field-service/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/field-service/issues/new?body=module:%20fieldservice_portal%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/field-service/issues/new?body=module:%20fieldservice_portal%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Expand All @@ -61,6 +61,9 @@ Contributors

* Alessio Renda <alessio.renda@pytech.it>

- [APSL-Nagarro](https://www.apsl.tech):
- Patryk Pyczko \<<ppyczko@apsl.net>\>

Maintainers
~~~~~~~~~~~

Expand All @@ -83,8 +86,8 @@ promote its widespread use.

Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-aleuffre| |maintainer-renda-dev|
|maintainer-aleuffre| |maintainer-renda-dev|

This module is part of the `OCA/field-service <https://github.com/OCA/field-service/tree/14.0/fieldservice_portal>`_ project on GitHub.
This module is part of the `OCA/field-service <https://github.com/OCA/field-service/tree/15.0/fieldservice_portal>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
9 changes: 7 additions & 2 deletions fieldservice_portal/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Field Service - Order Portal",
"version": "14.0.1.0.0",
"name": "Field Service - Portal",
"version": "15.0.1.0.0",
"summary": """
Bridge module between fieldservice and portal.
""",
Expand All @@ -23,6 +23,11 @@
"demo/fsm_location_demo.xml",
"demo/fsm_order_demo.xml",
],
"assets": {
"web.assets_frontend": [
"fieldservice_portal/static/src/js/fsm_order_portal.js",
],
},
"installable": True,
"application": False,
}
28 changes: 14 additions & 14 deletions fieldservice_portal/controllers/fsm_order_portal.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,17 @@


class CustomerPortal(CustomerPortal):
def _prepare_portal_layout_values(self):
values = super()._prepare_portal_layout_values()
fsm_order_count = (
request.env["fsm.order"].search_count([])
if request.env["fsm.order"].check_access_rights(
"read", raise_exception=False
def _prepare_home_portal_values(self, counters):
values = super()._prepare_home_portal_values(counters)
if "fsm_order_count" in counters:
fsm_order_count = (
request.env["fsm.order"].search_count([])
if request.env["fsm.order"].check_access_rights(
"read", raise_exception=False
)
else 0
)
else 0
)
values["fsm_order_count"] = fsm_order_count
values["fsm_order_count"] = fsm_order_count
return values

def _fsm_order_check_access(self, order_id):
Expand Down Expand Up @@ -49,7 +50,7 @@ def fsm_order_get_page_view_values(self, order, **kwargs):
return values

@http.route(
["/my/workorders", "/my/workorders/page/<int:page>"],
["/my/fsm_orders", "/my/fsm_orders/page/<int:page>"],
type="http",
auth="user",
website=True,
Expand Down Expand Up @@ -81,7 +82,6 @@ def portal_my_fsm_orders(
searchbar_groupby = {
"none": {"input": "none", "label": _("None")},
"location_id": {"input": "location", "label": _("Location")},
"ticket_id": {"input": "ticket", "label": _("Ticket")},
"stage_id": {"input": "stage", "label": _("Stage")},
"type": {"input": "type", "label": _("Type")},
}
Expand Down Expand Up @@ -154,7 +154,7 @@ def portal_my_fsm_orders(
fsm_order_count = FsmOrder.search_count(domain)
# pager
pager = portal_pager(
url="/my/workorders",
url="/my/fsm_orders",
url_args={},
total=fsm_order_count,
page=page,
Expand Down Expand Up @@ -182,7 +182,7 @@ def portal_my_fsm_orders(
"grouped_orders": grouped_orders,
"page_name": "fsm_order",
"pager": pager,
"default_url": "/my/workorders",
"default_url": "/my/fsm_orders",
"searchbar_sortings": searchbar_sortings,
"searchbar_groupby": searchbar_groupby,
"searchbar_inputs": searchbar_inputs,
Expand All @@ -196,7 +196,7 @@ def portal_my_fsm_orders(
return request.render("fieldservice_portal.portal_my_fsm_orders", values)

@http.route(
["/my/workorder/<int:order_id>"],
["/my/fsm_order/<int:order_id>"],
type="http",
website=True,
)
Expand Down
3 changes: 3 additions & 0 deletions fieldservice_portal/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
* `PyTech SRL <https://www.pytech.it>`_:

* Alessio Renda <alessio.renda@pytech.it>

- [APSL-Nagarro](https://www.apsl.tech):
- Patryk Pyczko \<<ppyczko@apsl.net>\>
Binary file added fieldservice_portal/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 23 additions & 11 deletions fieldservice_portal/static/description/index.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
<title>Field Service - Order Portal</title>
<title>Field Service - Portal</title>
<style type="text/css">

/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Copyright: This stylesheet has been placed in the public domain.

Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.

See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
Expand Down Expand Up @@ -275,7 +275,7 @@
margin-left: 2em ;
margin-right: 2em }

pre.code .ln { color: grey; } /* line numbers */
pre.code .ln { color: gray; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
Expand All @@ -301,7 +301,7 @@
span.pre {
white-space: pre }

span.problematic {
span.problematic, pre.problematic {
color: red }

span.section-subtitle {
Expand Down Expand Up @@ -360,16 +360,16 @@
</style>
</head>
<body>
<div class="document" id="field-service-order-portal">
<h1 class="title">Field Service - Order Portal</h1>
<div class="document" id="field-service-portal">
<h1 class="title">Field Service - Portal</h1>

<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:bfddb8307746f6f3179ded15fd2c7b9a6622c6e21d24ae73c9aece10a7f455f6
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/field-service/tree/14.0/fieldservice_portal"><img alt="OCA/field-service" src="https://img.shields.io/badge/github-OCA%2Ffield--service-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/field-service-14-0/field-service-14-0-fieldservice_portal"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/field-service&amp;target_branch=14.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/field-service/tree/15.0/fieldservice_portal"><img alt="OCA/field-service" src="https://img.shields.io/badge/github-OCA%2Ffield--service-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/field-service-15-0/field-service-15-0-fieldservice_portal"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/field-service&amp;target_branch=15.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>Bridge module between fieldservice and portal that allows portal users
to monitor work orders related to their locations.</p>
<p><strong>Table of contents</strong></p>
Expand All @@ -389,7 +389,7 @@ <h1><a class="toc-backref" href="#toc-entry-1">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/field-service/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/field-service/issues/new?body=module:%20fieldservice_portal%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/field-service/issues/new?body=module:%20fieldservice_portal%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
Expand All @@ -411,17 +411,29 @@ <h2><a class="toc-backref" href="#toc-entry-4">Contributors</a></h2>
</blockquote>
</li>
</ul>
<ul class="simple">
<li><dl class="first docutils">
<dt>[APSL-Nagarro](<a class="reference external" href="https://www.apsl.tech">https://www.apsl.tech</a>):</dt>
<dd><ul class="first last">
<li>Patryk Pyczko &lt;&lt;<a class="reference external" href="mailto:ppyczko&#64;apsl.net">ppyczko&#64;apsl.net</a>&gt;&gt;</li>
</ul>
</dd>
</dl>
</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-5">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
</a>
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainers</a>:</p>
<p><a class="reference external image-reference" href="https://github.com/aleuffre"><img alt="aleuffre" src="https://github.com/aleuffre.png?size=40px" /></a> <a class="reference external image-reference" href="https://github.com/renda-dev"><img alt="renda-dev" src="https://github.com/renda-dev.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/field-service/tree/14.0/fieldservice_portal">OCA/field-service</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/field-service/tree/15.0/fieldservice_portal">OCA/field-service</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
Expand Down
13 changes: 13 additions & 0 deletions fieldservice_portal/static/src/js/fsm_order_portal.esm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/** @odoo-module */

import "portal.portal"; // Force dependencies
import publicWidget from "web.public.widget";

publicWidget.registry.PortalHomeCounters.include({
/**
* @override
*/
_getCountersAlwaysDisplayed() {
return this._super(...arguments).concat(["fsm_order_count"]);
},
});
1 change: 1 addition & 0 deletions fieldservice_portal/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import test_portal
Loading

0 comments on commit a770f0c

Please sign in to comment.