From 444aae6f11693caba4dd0104609d90ec5888b3d8 Mon Sep 17 00:00:00 2001 From: ilo Date: Mon, 9 Sep 2024 15:20:12 -0300 Subject: [PATCH] [MIG] fieldservice_agreement: Migration to 17.0 The `agreement_serviceprofile` dependency has been moved to a glue module `fieldservice_agreement_serviceprofile`. --- fieldservice_agreement/README.rst | 63 ++++++++------ fieldservice_agreement/__manifest__.py | 5 +- fieldservice_agreement/models/__init__.py | 5 +- fieldservice_agreement/models/agreement.py | 82 ++++++++++--------- .../models/fsm_equipment.py | 1 - fieldservice_agreement/models/fsm_location.py | 29 ------- fieldservice_agreement/models/fsm_order.py | 1 - fieldservice_agreement/models/fsm_person.py | 44 +++++----- fieldservice_agreement/pyproject.toml | 3 + fieldservice_agreement/readme/CONFIGURE.md | 1 + fieldservice_agreement/readme/CONFIGURE.rst | 0 fieldservice_agreement/readme/CONTRIBUTORS.md | 6 ++ .../readme/CONTRIBUTORS.rst | 4 - .../readme/{CREDITS.rst => CREDITS.md} | 2 +- fieldservice_agreement/readme/DESCRIPTION.md | 7 ++ fieldservice_agreement/readme/DESCRIPTION.rst | 7 -- fieldservice_agreement/readme/ROADMAP.md | 1 + fieldservice_agreement/readme/ROADMAP.rst | 0 fieldservice_agreement/readme/USAGE.md | 8 ++ fieldservice_agreement/readme/USAGE.rst | 7 -- .../static/description/index.html | 71 +++++++++------- .../tests/test_fsm_agreement.py | 20 ++--- .../views/agreement_view.xml | 57 ++----------- .../views/fsm_equipment_view.xml | 19 ++--- fieldservice_agreement/views/fsm_location.xml | 22 ----- .../views/fsm_order_view.xml | 19 ++--- fieldservice_agreement/views/fsm_person.xml | 2 +- 27 files changed, 202 insertions(+), 284 deletions(-) delete mode 100644 fieldservice_agreement/models/fsm_location.py create mode 100644 fieldservice_agreement/pyproject.toml create mode 100644 fieldservice_agreement/readme/CONFIGURE.md delete mode 100644 fieldservice_agreement/readme/CONFIGURE.rst create mode 100644 fieldservice_agreement/readme/CONTRIBUTORS.md delete mode 100644 fieldservice_agreement/readme/CONTRIBUTORS.rst rename fieldservice_agreement/readme/{CREDITS.rst => CREDITS.md} (72%) create mode 100644 fieldservice_agreement/readme/DESCRIPTION.md delete mode 100644 fieldservice_agreement/readme/DESCRIPTION.rst create mode 100644 fieldservice_agreement/readme/ROADMAP.md delete mode 100644 fieldservice_agreement/readme/ROADMAP.rst create mode 100644 fieldservice_agreement/readme/USAGE.md delete mode 100644 fieldservice_agreement/readme/USAGE.rst delete mode 100644 fieldservice_agreement/views/fsm_location.xml diff --git a/fieldservice_agreement/README.rst b/fieldservice_agreement/README.rst index be8ef8c812..1624fe1a87 100644 --- a/fieldservice_agreement/README.rst +++ b/fieldservice_agreement/README.rst @@ -17,40 +17,51 @@ Field Service - Agreements :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/16.0/fieldservice_agreement + :target: https://github.com/OCA/field-service/tree/17.0/fieldservice_agreement :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-16-0/field-service-16-0-fieldservice_agreement + :target: https://translation.odoo-community.org/projects/field-service-17-0/field-service-17-0-fieldservice_agreement :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=16.0 + :target: https://runboat.odoo-community.org/builds?repo=OCA/field-service&target_branch=17.0 :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| -Odoo Agreement App does not provide an easy way to access field service orders -related to an agreement. Some organizations needs to have a quick access to -field service orders to track the performance of an agreement. +Odoo Agreement App does not provide an easy way to access field service +orders related to an agreement. Some organizations needs to have a quick +access to field service orders to track the performance of an agreement. -This module allows you to link a field service order to an agreement and adds a -smart button on the agreement to look at the list of related field service -orders. +This module allows you to link a field service order to an agreement and +adds a smart button on the agreement to look at the list of related +field service orders. **Table of contents** .. contents:: :local: +Configuration +============= + + + Usage ===== To use this module: -* Go to Field Service > Operations > Orders -* Select or create a field service order and set the agreement -* Go to Agreement > Agreements -* Open the previous agreement -* Click on the smart button "Service Orders" to see the list of related field service orders +- Go to Field Service > Operations > Orders +- Select or create a field service order and set the agreement +- Go to Agreement > Agreements +- Open the previous agreement +- Click on the smart button "Service Orders" to see the list of related + field service orders + +Known issues / Roadmap +====================== + + Bug Tracker =========== @@ -58,7 +69,7 @@ Bug Tracker Bugs are tracked on `GitHub 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 `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -66,27 +77,29 @@ Credits ======= Authors -~~~~~~~ +------- * Open Source Integrators Contributors -~~~~~~~~~~~~ +------------ -* Bhavesh Odedra -* Sandip Mangukiya -* Serpent Consulting Services Pvt. Ltd. -* Patrick Wilson +- Bhavesh Odedra +- Sandip Mangukiya +- Serpent Consulting Services Pvt. Ltd. +- Patrick Wilson +- Italo Lopes +- Iván Todorovich Other credits -~~~~~~~~~~~~~ +------------- The development of this module has been financially supported by: -* Open Source Integrators +- Open Source Integrators Maintainers -~~~~~~~~~~~ +----------- This module is maintained by the OCA. @@ -118,6 +131,6 @@ Current `maintainers `__: |maintainer-max3903| |maintainer-bodedra| |maintainer-smangukiya| |maintainer-osi-scampbell| |maintainer-patrickrwilson| -This module is part of the `OCA/field-service `_ project on GitHub. +This module is part of the `OCA/field-service `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/fieldservice_agreement/__manifest__.py b/fieldservice_agreement/__manifest__.py index 1d0d3f9055..b2d1b0bfe9 100644 --- a/fieldservice_agreement/__manifest__.py +++ b/fieldservice_agreement/__manifest__.py @@ -8,14 +8,13 @@ "website": "https://github.com/OCA/field-service", "category": "Field Service", "license": "AGPL-3", - "version": "16.0.1.0.0", - "depends": ["fieldservice", "agreement_serviceprofile"], + "version": "17.0.1.0.0", + "depends": ["fieldservice", "agreement"], "data": [ "views/fsm_order_view.xml", "views/fsm_equipment_view.xml", "views/agreement_view.xml", "views/fsm_person.xml", - "views/fsm_location.xml", ], "installable": True, "development_status": "Beta", diff --git a/fieldservice_agreement/models/__init__.py b/fieldservice_agreement/models/__init__.py index 07872822b7..d5a0db88f6 100644 --- a/fieldservice_agreement/models/__init__.py +++ b/fieldservice_agreement/models/__init__.py @@ -1,3 +1,6 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from . import agreement, fsm_equipment, fsm_location, fsm_order, fsm_person +from . import agreement +from . import fsm_equipment +from . import fsm_order +from . import fsm_person diff --git a/fieldservice_agreement/models/agreement.py b/fieldservice_agreement/models/agreement.py index 60573c2d5b..9b21260a75 100644 --- a/fieldservice_agreement/models/agreement.py +++ b/fieldservice_agreement/models/agreement.py @@ -14,47 +14,49 @@ class Agreement(models.Model): fsm_location_id = fields.Many2one("fsm.location", string="FSM Location") def _compute_service_order_count(self): - for agreement in self: - agreement.service_order_count = self.env["fsm.order"].search_count( - [("agreement_id", "=", agreement.id)] - ) - - def action_view_service_order(self): - for agreement in self: - fsm_order_ids = self.env["fsm.order"].search( - [("agreement_id", "=", agreement.id)] - ) - action = self.env["ir.actions.act_window"]._for_xml_id( - "fieldservice.action_fsm_operation_order" - ) - if len(fsm_order_ids) == 1: - action["views"] = [ - (self.env.ref("fieldservice.fsm_order_form").id, "form") - ] - action["res_id"] = fsm_order_ids.ids[0] - else: - action["domain"] = [("id", "in", fsm_order_ids.ids)] - return action + data = self.env["fsm.order"]._read_group( + [('agreement_id', 'in', self.ids)], + ['agreement_id'], + ['__count'], + ) + counts = {rec.id: count for rec, count in data} + for rec in self: + rec.service_order_count = counts.get(rec.id, 0) def _compute_equipment_count(self): - for agreement in self: - agreement.equipment_count = self.env["fsm.equipment"].search_count( - [("agreement_id", "=", agreement.id)] - ) + data = self.env["fsm.equipment"]._read_group( + [('agreement_id', 'in', self.ids)], + ['agreement_id'], + ['__count'], + ) + counts = {rec.id: count for rec, count in data} + for rec in self: + rec.equipment_count = counts.get(rec.id, 0) + + def action_view_service_order(self): + action = self.env["ir.actions.act_window"]._for_xml_id( + "fieldservice.action_fsm_operation_order" + ) + orders = self.env["fsm.order"].search([("agreement_id", "in", self.ids)]) + if len(orders) == 1: + action["views"] = [(self.env.ref("fieldservice.fsm_order_form").id, "form")] + action["res_id"] = orders.id + else: + action["domain"] = [("id", "in", orders.ids)] + return action def action_view_fsm_equipment(self): - for agreement in self: - equipment_ids = self.env["fsm.equipment"].search( - [("agreement_id", "=", agreement.id)] - ) - action = self.env["ir.actions.act_window"]._for_xml_id( - "fieldservice.action_fsm_equipment" - ) - if len(equipment_ids) == 1: - action["views"] = [ - (self.env.ref("fieldservice.fsm_equipment_form_view").id, "form") - ] - action["res_id"] = equipment_ids.ids[0] - else: - action["domain"] = [("id", "in", equipment_ids.ids)] - return action + action = self.env["ir.actions.act_window"]._for_xml_id( + "fieldservice.action_fsm_equipment" + ) + equipments = self.env["fsm.equipment"].search( + [("agreement_id", "in", self.ids)] + ) + if len(equipments) == 1: + action["views"] = [ + (self.env.ref("fieldservice.fsm_equipment_form_view").id, "form") + ] + action["res_id"] = equipments.id + else: + action["domain"] = [("id", "in", equipments.ids)] + return action diff --git a/fieldservice_agreement/models/fsm_equipment.py b/fieldservice_agreement/models/fsm_equipment.py index 2410b54777..8ff8d7f374 100644 --- a/fieldservice_agreement/models/fsm_equipment.py +++ b/fieldservice_agreement/models/fsm_equipment.py @@ -8,4 +8,3 @@ class FSMEquipment(models.Model): _inherit = "fsm.equipment" agreement_id = fields.Many2one("agreement", string="Agreement") - serviceprofile_id = fields.Many2one("agreement.serviceprofile", "Service Profile") diff --git a/fieldservice_agreement/models/fsm_location.py b/fieldservice_agreement/models/fsm_location.py deleted file mode 100644 index 053ae93b16..0000000000 --- a/fieldservice_agreement/models/fsm_location.py +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright (C) 2018 - TODAY, Open Source Integrators -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). - -from odoo import fields, models - - -class FSMLocation(models.Model): - _inherit = "fsm.location" - - serviceprofile_ids = fields.Many2many( - "agreement.serviceprofile", - string="Service Profiles", - compute="_compute_service_ids", - ) - - def _compute_service_ids(self): - for loc in self: - agreements = self.env["agreement"].search( - [("fsm_location_id", "=", loc.id)] - ) - ids = [] - for agree in agreements: - servpros = self.env["agreement.serviceprofile"].search( - [("agreement_id", "=", agree.id)] - ) - for ser in servpros: - if ser.id not in ids: - ids.append(ser.id) - loc.serviceprofile_ids = ids diff --git a/fieldservice_agreement/models/fsm_order.py b/fieldservice_agreement/models/fsm_order.py index a6e0151247..1138f20ce4 100644 --- a/fieldservice_agreement/models/fsm_order.py +++ b/fieldservice_agreement/models/fsm_order.py @@ -8,4 +8,3 @@ class FSMOrder(models.Model): _inherit = "fsm.order" agreement_id = fields.Many2one("agreement", string="Agreement") - serviceprofile_id = fields.Many2one("agreement.serviceprofile", "Service Profile") diff --git a/fieldservice_agreement/models/fsm_person.py b/fieldservice_agreement/models/fsm_person.py index 1cea305e97..2e1781b60e 100644 --- a/fieldservice_agreement/models/fsm_person.py +++ b/fieldservice_agreement/models/fsm_person.py @@ -8,30 +8,30 @@ class FSMPerson(models.Model): _inherit = "fsm.person" agreement_count = fields.Integer( - string="# of Agreements", compute="_compute_agreements" + string="# of Agreements", + compute="_compute_agreement_count", ) - def _compute_agreements(self): - self.agreement_count = self.env["agreement"].search_count( - [("partner_id", "=", self.name)] + def _compute_agreement_count(self): + data = self.env["agreement"]._read_group( + [('partner_id', 'in', self.partner_id.ids)], + ['partner_id'], + ['__count'], ) + counts = {rec.id: count for rec, count in data} + for rec in self: + rec.agreement_count = counts.get(rec.partner_id.id, 0) def action_view_agreements(self): - for person in self: - action = self.env["ir.actions.act_window"]._for_xml_id( - "agreement_legal.agreement_operations_agreement" - ) - agreements = self.env["agreement"].search( - [("partner_id", "=", person.partner_id.id)] - ) - if len(agreements) == 1: - action["views"] = [ - ( - self.env.ref("agreement_legal.partner_agreement_form_view").id, - "form", - ) - ] - action["res_id"] = agreements.id - else: - action["domain"] = [("id", "in", agreements.ids)] - return action + action = self.env["ir.actions.act_window"]._for_xml_id( + "agreement.agreement_action" + ) + records = self.env["agreement"].search( + [("partner_id", "in", self.partner_id.ids)] + ) + if len(records) == 1: + action["views"] = [(self.env.ref("agreement.agreement_form").id, "form")] + action["res_id"] = records.id + else: + action["domain"] = [("id", "in", records.ids)] + return action diff --git a/fieldservice_agreement/pyproject.toml b/fieldservice_agreement/pyproject.toml new file mode 100644 index 0000000000..4231d0cccb --- /dev/null +++ b/fieldservice_agreement/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/fieldservice_agreement/readme/CONFIGURE.md b/fieldservice_agreement/readme/CONFIGURE.md new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/fieldservice_agreement/readme/CONFIGURE.md @@ -0,0 +1 @@ + diff --git a/fieldservice_agreement/readme/CONFIGURE.rst b/fieldservice_agreement/readme/CONFIGURE.rst deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/fieldservice_agreement/readme/CONTRIBUTORS.md b/fieldservice_agreement/readme/CONTRIBUTORS.md new file mode 100644 index 0000000000..2cd827c901 --- /dev/null +++ b/fieldservice_agreement/readme/CONTRIBUTORS.md @@ -0,0 +1,6 @@ +- Bhavesh Odedra \<\> +- Sandip Mangukiya \<\> +- Serpent Consulting Services Pvt. Ltd. \<\> +- Patrick Wilson \<\> +- Italo Lopes \<\> +- Iván Todorovich \<\> diff --git a/fieldservice_agreement/readme/CONTRIBUTORS.rst b/fieldservice_agreement/readme/CONTRIBUTORS.rst deleted file mode 100644 index a31aa4664e..0000000000 --- a/fieldservice_agreement/readme/CONTRIBUTORS.rst +++ /dev/null @@ -1,4 +0,0 @@ -* Bhavesh Odedra -* Sandip Mangukiya -* Serpent Consulting Services Pvt. Ltd. -* Patrick Wilson diff --git a/fieldservice_agreement/readme/CREDITS.rst b/fieldservice_agreement/readme/CREDITS.md similarity index 72% rename from fieldservice_agreement/readme/CREDITS.rst rename to fieldservice_agreement/readme/CREDITS.md index 8209266d99..f276e4261e 100644 --- a/fieldservice_agreement/readme/CREDITS.rst +++ b/fieldservice_agreement/readme/CREDITS.md @@ -1,3 +1,3 @@ The development of this module has been financially supported by: -* Open Source Integrators +- Open Source Integrators diff --git a/fieldservice_agreement/readme/DESCRIPTION.md b/fieldservice_agreement/readme/DESCRIPTION.md new file mode 100644 index 0000000000..eced13c0e0 --- /dev/null +++ b/fieldservice_agreement/readme/DESCRIPTION.md @@ -0,0 +1,7 @@ +Odoo Agreement App does not provide an easy way to access field service +orders related to an agreement. Some organizations needs to have a quick +access to field service orders to track the performance of an agreement. + +This module allows you to link a field service order to an agreement and +adds a smart button on the agreement to look at the list of related +field service orders. diff --git a/fieldservice_agreement/readme/DESCRIPTION.rst b/fieldservice_agreement/readme/DESCRIPTION.rst deleted file mode 100644 index 715fea45c6..0000000000 --- a/fieldservice_agreement/readme/DESCRIPTION.rst +++ /dev/null @@ -1,7 +0,0 @@ -Odoo Agreement App does not provide an easy way to access field service orders -related to an agreement. Some organizations needs to have a quick access to -field service orders to track the performance of an agreement. - -This module allows you to link a field service order to an agreement and adds a -smart button on the agreement to look at the list of related field service -orders. diff --git a/fieldservice_agreement/readme/ROADMAP.md b/fieldservice_agreement/readme/ROADMAP.md new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/fieldservice_agreement/readme/ROADMAP.md @@ -0,0 +1 @@ + diff --git a/fieldservice_agreement/readme/ROADMAP.rst b/fieldservice_agreement/readme/ROADMAP.rst deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/fieldservice_agreement/readme/USAGE.md b/fieldservice_agreement/readme/USAGE.md new file mode 100644 index 0000000000..ef70ef822f --- /dev/null +++ b/fieldservice_agreement/readme/USAGE.md @@ -0,0 +1,8 @@ +To use this module: + +- Go to Field Service \> Operations \> Orders +- Select or create a field service order and set the agreement +- Go to Agreement \> Agreements +- Open the previous agreement +- Click on the smart button "Service Orders" to see the list of related + field service orders diff --git a/fieldservice_agreement/readme/USAGE.rst b/fieldservice_agreement/readme/USAGE.rst deleted file mode 100644 index 13f061ff60..0000000000 --- a/fieldservice_agreement/readme/USAGE.rst +++ /dev/null @@ -1,7 +0,0 @@ -To use this module: - -* Go to Field Service > Operations > Orders -* Select or create a field service order and set the agreement -* Go to Agreement > Agreements -* Open the previous agreement -* Click on the smart button "Service Orders" to see the list of related field service orders diff --git a/fieldservice_agreement/static/description/index.html b/fieldservice_agreement/static/description/index.html index 0653fd5abc..e35aa34562 100644 --- a/fieldservice_agreement/static/description/index.html +++ b/fieldservice_agreement/static/description/index.html @@ -1,4 +1,3 @@ - @@ -9,10 +8,11 @@ /* :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. @@ -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 } @@ -301,7 +301,7 @@ span.pre { white-space: pre } -span.problematic { +span.problematic, pre.problematic { color: red } span.section-subtitle { @@ -369,80 +369,93 @@

Field Service - Agreements

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! source digest: sha256:816250d8ffb8cfea7c4b4b6dba339375ea9264b6ff922a6c0d346939ffe04116 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: AGPL-3 OCA/field-service Translate me on Weblate Try me on Runboat

-

Odoo Agreement App does not provide an easy way to access field service orders -related to an agreement. Some organizations needs to have a quick access to -field service orders to track the performance of an agreement.

-

This module allows you to link a field service order to an agreement and adds a -smart button on the agreement to look at the list of related field service -orders.

+

Beta License: AGPL-3 OCA/field-service Translate me on Weblate Try me on Runboat

+

Odoo Agreement App does not provide an easy way to access field service +orders related to an agreement. Some organizations needs to have a quick +access to field service orders to track the performance of an agreement.

+

This module allows you to link a field service order to an agreement and +adds a smart button on the agreement to look at the list of related +field service orders.

Table of contents

+
-

Usage

+

Usage

To use this module:

  • Go to Field Service > Operations > Orders
  • Select or create a field service order and set the agreement
  • Go to Agreement > Agreements
  • Open the previous agreement
  • -
  • Click on the smart button “Service Orders” to see the list of related field service orders
  • +
  • Click on the smart button “Service Orders” to see the list of related +field service orders
+
-

Bug Tracker

+

Bug Tracker

Bugs are tracked on GitHub 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.

+feedback.

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

-

Credits

+

Credits

-

Authors

+

Authors

  • Open Source Integrators
-

Contributors

+

Contributors

-

Other credits

+

Other credits

The development of this module has been financially supported by:

  • Open Source Integrators
-

Maintainers

+

Maintainers

This module is maintained by the OCA.

-Odoo Community Association + +Odoo Community Association +

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.

Current maintainers:

max3903 bodedra smangukiya osi-scampbell patrickrwilson

-

This module is part of the OCA/field-service project on GitHub.

+

This module is part of the OCA/field-service project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

diff --git a/fieldservice_agreement/tests/test_fsm_agreement.py b/fieldservice_agreement/tests/test_fsm_agreement.py index c3fc9b6418..b6187d0790 100644 --- a/fieldservice_agreement/tests/test_fsm_agreement.py +++ b/fieldservice_agreement/tests/test_fsm_agreement.py @@ -7,13 +7,14 @@ class FSMOrder(TransactionCase): def setUp(self): - super(FSMOrder, self).setUp() + super().setUp() self.Order = self.env["fsm.order"] self.Agreement = self.env["agreement"] - self.Serviceprofile = self.env["agreement.serviceprofile"] self.Equipment = self.env["fsm.equipment"] self.test_location = self.env.ref("fieldservice.test_location") - self.agreement_type = self.env.ref("agreement_legal.agreement_type_agreement") + self.agreement_type = self.env["agreement.type"].create( + {"name": "Test Agreement Type"} + ) self.test_person = self.env.ref("fieldservice.test_person") self.service = self.env.ref("product.product_product_1_product_template") @@ -25,22 +26,15 @@ def test_fsm_agreement(self): - Person (partner) can relate back to agreement correctly """ # Create agreement and assign to test location - view_id = "agreement_legal.partner_agreement_form_view" + view_id = "agreement.agreement_form" with Form(self.Agreement, view=view_id) as f: f.name = "Test Agreement" f.agreement_type_id = self.agreement_type - f.description = "Test Agreement" + f.code = "TestAgreement" f.start_date = f.end_date = fields.Date.today() f.fsm_location_id = self.test_location f.partner_id = self.test_person.partner_id agreement = f.save() - profile = self.Serviceprofile.create( - { - "name": "Test Profile", - "agreement_id": agreement.id, - "product_id": self.service.id, - } - ) # Create 2 Orders, that link to this agreement vals = { "name": "Order1", @@ -81,8 +75,6 @@ def test_fsm_agreement(self): [equipment1.id, equipment2.id, equipment3.id], agreement.action_view_fsm_equipment()["domain"][0][2], ) - # Location's service profile display correctly - self.assertEqual(self.test_location.serviceprofile_ids, profile) # Person (partner) can relate back to agreement correctly self.assertEqual(self.test_person.agreement_count, 1) self.assertEqual( diff --git a/fieldservice_agreement/views/agreement_view.xml b/fieldservice_agreement/views/agreement_view.xml index 9ca6a35ff9..9e43947702 100644 --- a/fieldservice_agreement/views/agreement_view.xml +++ b/fieldservice_agreement/views/agreement_view.xml @@ -1,10 +1,9 @@ + - - - agreement.form.fsm.order.view + agreement - +