From e20216217922a1963d533b1f0deb6feb43c61fa9 Mon Sep 17 00:00:00 2001 From: anusrinps96 Date: Tue, 15 Oct 2024 17:15:40 +0200 Subject: [PATCH] [MIG] fieldservice_portal: Migation to 16.0 --- fieldservice_portal/README.rst | 6 +- fieldservice_portal/__manifest__.py | 7 +- .../controllers/fsm_order_portal.py | 19 +-- .../static/description/index.html | 6 +- .../static/src/js/fsm_order_portal.js | 13 ++ fieldservice_portal/tests/__init__.py | 1 + fieldservice_portal/tests/test_portal.py | 136 ++++++++++++++++++ .../views/fsm_order_template.xml | 16 +-- fieldservice_portal/views/portal_template.xml | 13 +- 9 files changed, 187 insertions(+), 30 deletions(-) create mode 100644 fieldservice_portal/static/src/js/fsm_order_portal.js create mode 100644 fieldservice_portal/tests/__init__.py create mode 100644 fieldservice_portal/tests/test_portal.py diff --git a/fieldservice_portal/README.rst b/fieldservice_portal/README.rst index c91e2a3992..62b7b3f5f5 100644 --- a/fieldservice_portal/README.rst +++ b/fieldservice_portal/README.rst @@ -1,6 +1,6 @@ -============================ -Field Service - Order Portal -============================ +====================== +Field Service - Portal +====================== .. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! diff --git a/fieldservice_portal/__manifest__.py b/fieldservice_portal/__manifest__.py index 6a983e3a9c..b159c19e6a 100644 --- a/fieldservice_portal/__manifest__.py +++ b/fieldservice_portal/__manifest__.py @@ -1,5 +1,5 @@ { - "name": "Field Service - Order Portal", + "name": "Field Service - Portal", "version": "16.0.1.0.0", "summary": """ Bridge module between fieldservice and portal. @@ -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, } diff --git a/fieldservice_portal/controllers/fsm_order_portal.py b/fieldservice_portal/controllers/fsm_order_portal.py index 37ace8ab8d..faa6df0709 100644 --- a/fieldservice_portal/controllers/fsm_order_portal.py +++ b/fieldservice_portal/controllers/fsm_order_portal.py @@ -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): diff --git a/fieldservice_portal/static/description/index.html b/fieldservice_portal/static/description/index.html index 50f093cf77..509e880adb 100644 --- a/fieldservice_portal/static/description/index.html +++ b/fieldservice_portal/static/description/index.html @@ -3,7 +3,7 @@ -Field Service - Order Portal +Field Service - Portal -
-

Field Service - Order Portal

+
+

Field Service - Portal