diff --git a/maintenance_request_stage_transition/README.rst b/maintenance_request_stage_transition/README.rst new file mode 100644 index 000000000..47a9d0eb9 --- /dev/null +++ b/maintenance_request_stage_transition/README.rst @@ -0,0 +1,92 @@ +==================================== +Maintenance Request Stage transition +==================================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fmaintenance-lightgray.png?logo=github + :target: https://github.com/OCA/maintenance/tree/15.0/maintenance_request_stage_transition + :alt: OCA/maintenance +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/maintenance-15-0/maintenance-15-0-maintenance_request_stage_transition + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/240/15.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +It allows to define the next stages of a stage and shows them on the header buttons. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +* Access `Maintenance > Configuration > Maintenance Stages` +* Define the possible next stages of every stage +* You can specify the color of the button if needed +* Refresh the page in order to show the new possible stages +* The stage widget will be blocked and the expected button will appear on the header. + +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 smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Creu Blanca + +Contributors +~~~~~~~~~~~~ + +* Enric Tobella +* Jaime Arroyo +* David Alonso + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +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. + +.. |maintainer-etobella| image:: https://github.com/etobella.png?size=40px + :target: https://github.com/etobella + :alt: etobella + +Current `maintainer `__: + +|maintainer-etobella| + +This module is part of the `OCA/maintenance `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/maintenance_request_stage_transition/__init__.py b/maintenance_request_stage_transition/__init__.py new file mode 100644 index 000000000..0650744f6 --- /dev/null +++ b/maintenance_request_stage_transition/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/maintenance_request_stage_transition/__manifest__.py b/maintenance_request_stage_transition/__manifest__.py new file mode 100644 index 000000000..143c56a4c --- /dev/null +++ b/maintenance_request_stage_transition/__manifest__.py @@ -0,0 +1,16 @@ +# Copyright 2019 Creu Blanca +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "Maintenance Request Stage transition", + "summary": """ + Manage transition visibility and management between stages""", + "version": "16.0.1.0.0", + "license": "AGPL-3", + "author": "Creu Blanca,Odoo Community Association (OCA)", + "website": "https://github.com/OCA/maintenance", + "depends": ["maintenance"], + "data": ["views/maintenance_request.xml", "views/maintenance_stage.xml"], + "demo": ["data/demo_maintenance_request_stage_transition.xml"], + "maintainers": ["etobella"], +} diff --git a/maintenance_request_stage_transition/data/demo_maintenance_request_stage_transition.xml b/maintenance_request_stage_transition/data/demo_maintenance_request_stage_transition.xml new file mode 100644 index 000000000..756abfa12 --- /dev/null +++ b/maintenance_request_stage_transition/data/demo_maintenance_request_stage_transition.xml @@ -0,0 +1,19 @@ + + + info + + + + warning + + + + success + + + danger + + diff --git a/maintenance_request_stage_transition/i18n/es.po b/maintenance_request_stage_transition/i18n/es.po new file mode 100644 index 000000000..eb8138edc --- /dev/null +++ b/maintenance_request_stage_transition/i18n/es.po @@ -0,0 +1,83 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * maintenance_request_stage_transition +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2021-07-14 15:48+0000\n" +"Last-Translator: Enric Tobella \n" +"Language-Team: none\n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.3.2\n" + +#. module: maintenance_request_stage_transition +#: model:ir.model.fields,field_description:maintenance_request_stage_transition.field_maintenance_stage__button_class +msgid "Button Class" +msgstr "Clase del Botón" + +#. module: maintenance_request_stage_transition +#: model:ir.model.fields.selection,name:maintenance_request_stage_transition.selection__maintenance_stage__button_class__danger +msgid "Danger" +msgstr "Peligro" + +#. module: maintenance_request_stage_transition +#: model:ir.model.fields,help:maintenance_request_stage_transition.field_maintenance_stage__button_class +msgid "For default, the system uses primary" +msgstr "Por defecto, el sistema usa Primario" + +#. module: maintenance_request_stage_transition +#: model:ir.model.fields.selection,name:maintenance_request_stage_transition.selection__maintenance_stage__button_class__info +msgid "Info" +msgstr "Info" + +#. module: maintenance_request_stage_transition +#: model:ir.model,name:maintenance_request_stage_transition.model_maintenance_request +msgid "Maintenance Request" +msgstr "Petición de mantenimiento" + +#. module: maintenance_request_stage_transition +#: model:ir.model,name:maintenance_request_stage_transition.model_maintenance_stage +msgid "Maintenance Stage" +msgstr "Estado" + +#. module: maintenance_request_stage_transition +#: model:ir.model.fields,field_description:maintenance_request_stage_transition.field_maintenance_stage__next_stage_ids +msgid "Next stages" +msgstr "Próximos estados" + +#. module: maintenance_request_stage_transition +#: model:ir.model.fields,field_description:maintenance_request_stage_transition.field_maintenance_stage__previous_stage_ids +msgid "Previous stages" +msgstr "Estados previos" + +#. module: maintenance_request_stage_transition +#: model:ir.model.fields.selection,name:maintenance_request_stage_transition.selection__maintenance_stage__button_class__primary +msgid "Primary" +msgstr "Primario" + +#. module: maintenance_request_stage_transition +#: model:ir.model.fields,field_description:maintenance_request_stage_transition.field_maintenance_request__stage_id +msgid "Stage" +msgstr "" + +#. module: maintenance_request_stage_transition +#: model:ir.model.fields.selection,name:maintenance_request_stage_transition.selection__maintenance_stage__button_class__success +msgid "Success" +msgstr "Éxito" + +#. module: maintenance_request_stage_transition +#: code:addons/maintenance_request_stage_transition/models/maintenance_stage.py:0 +#, python-format +msgid "To %s" +msgstr "A %s" + +#. module: maintenance_request_stage_transition +#: model:ir.model.fields.selection,name:maintenance_request_stage_transition.selection__maintenance_stage__button_class__warning +msgid "Warning" +msgstr "Advertencia" diff --git a/maintenance_request_stage_transition/i18n/it.po b/maintenance_request_stage_transition/i18n/it.po new file mode 100644 index 000000000..89e543f39 --- /dev/null +++ b/maintenance_request_stage_transition/i18n/it.po @@ -0,0 +1,83 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * maintenance_request_stage_transition +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 13.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2021-07-28 09:49+0000\n" +"Last-Translator: mymage \n" +"Language-Team: none\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.3.2\n" + +#. module: maintenance_request_stage_transition +#: model:ir.model.fields,field_description:maintenance_request_stage_transition.field_maintenance_stage__button_class +msgid "Button Class" +msgstr "Classe pulsante" + +#. module: maintenance_request_stage_transition +#: model:ir.model.fields.selection,name:maintenance_request_stage_transition.selection__maintenance_stage__button_class__danger +msgid "Danger" +msgstr "Pericolo" + +#. module: maintenance_request_stage_transition +#: model:ir.model.fields,help:maintenance_request_stage_transition.field_maintenance_stage__button_class +msgid "For default, the system uses primary" +msgstr "Il sistema usa come predefinito Primaria" + +#. module: maintenance_request_stage_transition +#: model:ir.model.fields.selection,name:maintenance_request_stage_transition.selection__maintenance_stage__button_class__info +msgid "Info" +msgstr "Informazioni" + +#. module: maintenance_request_stage_transition +#: model:ir.model,name:maintenance_request_stage_transition.model_maintenance_request +msgid "Maintenance Request" +msgstr "Richiesta manutenzione" + +#. module: maintenance_request_stage_transition +#: model:ir.model,name:maintenance_request_stage_transition.model_maintenance_stage +msgid "Maintenance Stage" +msgstr "Fase manutenzione" + +#. module: maintenance_request_stage_transition +#: model:ir.model.fields,field_description:maintenance_request_stage_transition.field_maintenance_stage__next_stage_ids +msgid "Next stages" +msgstr "Fase successiva" + +#. module: maintenance_request_stage_transition +#: model:ir.model.fields,field_description:maintenance_request_stage_transition.field_maintenance_stage__previous_stage_ids +msgid "Previous stages" +msgstr "Fase precedente" + +#. module: maintenance_request_stage_transition +#: model:ir.model.fields.selection,name:maintenance_request_stage_transition.selection__maintenance_stage__button_class__primary +msgid "Primary" +msgstr "Primaria" + +#. module: maintenance_request_stage_transition +#: model:ir.model.fields,field_description:maintenance_request_stage_transition.field_maintenance_request__stage_id +msgid "Stage" +msgstr "Fase" + +#. module: maintenance_request_stage_transition +#: model:ir.model.fields.selection,name:maintenance_request_stage_transition.selection__maintenance_stage__button_class__success +msgid "Success" +msgstr "Successo" + +#. module: maintenance_request_stage_transition +#: code:addons/maintenance_request_stage_transition/models/maintenance_stage.py:0 +#, python-format +msgid "To %s" +msgstr "A %s" + +#. module: maintenance_request_stage_transition +#: model:ir.model.fields.selection,name:maintenance_request_stage_transition.selection__maintenance_stage__button_class__warning +msgid "Warning" +msgstr "Attenzione" diff --git a/maintenance_request_stage_transition/i18n/maintenance_request_stage_transition.pot b/maintenance_request_stage_transition/i18n/maintenance_request_stage_transition.pot new file mode 100644 index 000000000..fe6d13141 --- /dev/null +++ b/maintenance_request_stage_transition/i18n/maintenance_request_stage_transition.pot @@ -0,0 +1,80 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * maintenance_request_stage_transition +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 15.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: maintenance_request_stage_transition +#: model:ir.model.fields,field_description:maintenance_request_stage_transition.field_maintenance_stage__button_class +msgid "Button Class" +msgstr "" + +#. module: maintenance_request_stage_transition +#: model:ir.model.fields.selection,name:maintenance_request_stage_transition.selection__maintenance_stage__button_class__danger +msgid "Danger" +msgstr "" + +#. module: maintenance_request_stage_transition +#: model:ir.model.fields,help:maintenance_request_stage_transition.field_maintenance_stage__button_class +msgid "For default, the system uses primary" +msgstr "" + +#. module: maintenance_request_stage_transition +#: model:ir.model.fields.selection,name:maintenance_request_stage_transition.selection__maintenance_stage__button_class__info +msgid "Info" +msgstr "" + +#. module: maintenance_request_stage_transition +#: model:ir.model,name:maintenance_request_stage_transition.model_maintenance_request +msgid "Maintenance Request" +msgstr "" + +#. module: maintenance_request_stage_transition +#: model:ir.model,name:maintenance_request_stage_transition.model_maintenance_stage +msgid "Maintenance Stage" +msgstr "" + +#. module: maintenance_request_stage_transition +#: model:ir.model.fields,field_description:maintenance_request_stage_transition.field_maintenance_stage__next_stage_ids +msgid "Next stages" +msgstr "" + +#. module: maintenance_request_stage_transition +#: model:ir.model.fields,field_description:maintenance_request_stage_transition.field_maintenance_stage__previous_stage_ids +msgid "Previous stages" +msgstr "" + +#. module: maintenance_request_stage_transition +#: model:ir.model.fields.selection,name:maintenance_request_stage_transition.selection__maintenance_stage__button_class__primary +msgid "Primary" +msgstr "" + +#. module: maintenance_request_stage_transition +#: model:ir.model.fields,field_description:maintenance_request_stage_transition.field_maintenance_request__stage_id +msgid "Stage" +msgstr "" + +#. module: maintenance_request_stage_transition +#: model:ir.model.fields.selection,name:maintenance_request_stage_transition.selection__maintenance_stage__button_class__success +msgid "Success" +msgstr "" + +#. module: maintenance_request_stage_transition +#: code:addons/maintenance_request_stage_transition/models/maintenance_stage.py:0 +#, python-format +msgid "To %s" +msgstr "" + +#. module: maintenance_request_stage_transition +#: model:ir.model.fields.selection,name:maintenance_request_stage_transition.selection__maintenance_stage__button_class__warning +msgid "Warning" +msgstr "" diff --git a/maintenance_request_stage_transition/models/__init__.py b/maintenance_request_stage_transition/models/__init__.py new file mode 100644 index 000000000..ef1710deb --- /dev/null +++ b/maintenance_request_stage_transition/models/__init__.py @@ -0,0 +1,2 @@ +from . import maintenance_stage +from . import maintenance_request diff --git a/maintenance_request_stage_transition/models/maintenance_request.py b/maintenance_request_stage_transition/models/maintenance_request.py new file mode 100644 index 000000000..997d39c9d --- /dev/null +++ b/maintenance_request_stage_transition/models/maintenance_request.py @@ -0,0 +1,43 @@ +# Copyright 2019 Creu Blanca +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from lxml import etree + +from odoo import api, fields, models + +from odoo.addons.base.models import ir_ui_view + + +class MaintenanceRequest(models.Model): + + _inherit = "maintenance.request" + + stage_id = fields.Many2one("maintenance.stage", readonly=True) + + @api.model + def get_view(self, view_id=None, view_type="form", **options): + res = super().get_view(view_id=view_id, view_type=view_type, **options) + if view_type == "form": + doc = etree.XML(res["arch"]) + stages = self.env["maintenance.stage"].search([], order="sequence desc") + header = doc.xpath("//form/header")[0] + for stage in stages: + node = stage._get_stage_node() + self._setup_modifiers(node) + header.insert(0, node) + res["arch"] = etree.tostring(doc, encoding="unicode") + return res + + def set_maintenance_stage(self): + if not self.env.context.get("next_stage_id"): + return {} + return self._set_maintenance_stage(self.env.context.get("next_stage_id")) + + def _set_maintenance_stage(self, stage_id): + self.write({"stage_id": stage_id}) + + @api.model + def _setup_modifiers(self, node): + modifiers = {} + ir_ui_view.transfer_node_to_modifiers(node, modifiers) + ir_ui_view.transfer_modifiers_to_node(modifiers, node) diff --git a/maintenance_request_stage_transition/models/maintenance_stage.py b/maintenance_request_stage_transition/models/maintenance_stage.py new file mode 100644 index 000000000..9d66ae677 --- /dev/null +++ b/maintenance_request_stage_transition/models/maintenance_stage.py @@ -0,0 +1,58 @@ +# Copyright 2019 Creu Blanca +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +import json + +from lxml import etree + +from odoo import _, fields, models + + +class MaintenanceStage(models.Model): + + _inherit = "maintenance.stage" + + next_stage_ids = fields.Many2many( + "maintenance.stage", + string="Next stages", + relation="maintenance_stage_next_stage", + column1="stage_id", + column2="next_stage_id", + ) + previous_stage_ids = fields.Many2many( + "maintenance.stage", + string="Previous stages", + relation="maintenance_stage_next_stage", + column1="next_stage_id", + column2="stage_id", + ) + button_class = fields.Selection( + [ + ("primary", "Primary"), + ("info", "Info"), + ("success", "Success"), + ("warning", "Warning"), + ("danger", "Danger"), + ], + help="For default, the system uses primary", + ) + + def _get_stage_node_attrs(self): + return {"invisible": [("stage_id", "not in", self.previous_stage_ids.ids)]} + + def _get_stage_node_name(self): + return _("To %s") % self.name + + def _get_stage_node(self): + return etree.Element( + "button", + attrib={ + "name": "set_maintenance_stage", + "id": str(self.id), + "type": "object", + "class": "btn-%s" % (self.button_class or "primary"), + "context": json.dumps({"next_stage_id": self.id}), + "attrs": json.dumps(self._get_stage_node_attrs()), + "string": self._get_stage_node_name(), + }, + ) diff --git a/maintenance_request_stage_transition/readme/CONTRIBUTORS.rst b/maintenance_request_stage_transition/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..73abe2903 --- /dev/null +++ b/maintenance_request_stage_transition/readme/CONTRIBUTORS.rst @@ -0,0 +1,3 @@ +* Enric Tobella +* Jaime Arroyo +* David Alonso diff --git a/maintenance_request_stage_transition/readme/DESCRIPTION.rst b/maintenance_request_stage_transition/readme/DESCRIPTION.rst new file mode 100644 index 000000000..8ee24d589 --- /dev/null +++ b/maintenance_request_stage_transition/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +It allows to define the next stages of a stage and shows them on the header buttons. diff --git a/maintenance_request_stage_transition/readme/USAGE.rst b/maintenance_request_stage_transition/readme/USAGE.rst new file mode 100644 index 000000000..9345f50e5 --- /dev/null +++ b/maintenance_request_stage_transition/readme/USAGE.rst @@ -0,0 +1,5 @@ +* Access `Maintenance > Configuration > Maintenance Stages` +* Define the possible next stages of every stage +* You can specify the color of the button if needed +* Refresh the page in order to show the new possible stages +* The stage widget will be blocked and the expected button will appear on the header. diff --git a/maintenance_request_stage_transition/static/description/icon.png b/maintenance_request_stage_transition/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/maintenance_request_stage_transition/static/description/icon.png differ diff --git a/maintenance_request_stage_transition/static/description/index.html b/maintenance_request_stage_transition/static/description/index.html new file mode 100644 index 000000000..9bd58c5d8 --- /dev/null +++ b/maintenance_request_stage_transition/static/description/index.html @@ -0,0 +1,434 @@ + + + + + + +Maintenance Request Stage transition + + + +
+

Maintenance Request Stage transition

+ + +

Beta License: AGPL-3 OCA/maintenance Translate me on Weblate Try me on Runbot

+

It allows to define the next stages of a stage and shows them on the header buttons.

+

Table of contents

+ +
+

Usage

+
    +
  • Access Maintenance > Configuration > Maintenance Stages
  • +
  • Define the possible next stages of every stage
  • +
  • You can specify the color of the button if needed
  • +
  • Refresh the page in order to show the new possible stages
  • +
  • The stage widget will be blocked and the expected button will appear on the header.
  • +
+
+
+

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 smashing it by providing a detailed and welcomed +feedback.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Creu Blanca
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+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 maintainer:

+

etobella

+

This module is part of the OCA/maintenance project on GitHub.

+

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

+
+
+
+ + diff --git a/maintenance_request_stage_transition/tests/__init__.py b/maintenance_request_stage_transition/tests/__init__.py new file mode 100644 index 000000000..de05063bc --- /dev/null +++ b/maintenance_request_stage_transition/tests/__init__.py @@ -0,0 +1 @@ +from . import test_flow diff --git a/maintenance_request_stage_transition/tests/test_flow.py b/maintenance_request_stage_transition/tests/test_flow.py new file mode 100644 index 000000000..c622803e2 --- /dev/null +++ b/maintenance_request_stage_transition/tests/test_flow.py @@ -0,0 +1,61 @@ +# Copyright 2019 Creu Blanca +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +import json + +from lxml import etree + +from odoo.tests.common import TransactionCase + + +class TestFlow(TransactionCase): + def setUp(self): + super().setUp() + self.request = self.env["maintenance.request"].create({"name": "Request"}) + self.original_stage = self.request.stage_id + self.last_stage = self.env["maintenance.stage"].create({"name": "Last state"}) + self.stage = self.env["maintenance.stage"].create( + {"name": "New state", "next_stage_ids": [(4, self.last_stage.id)]} + ) + self.original_stage.write({"next_stage_ids": [(4, self.stage.id)]}) + + def test_inverse(self): + self.assertIn(self.original_stage, self.stage.previous_stage_ids) + + def get_button(self, stage): + data = self.request.get_view(view_type="form") + form = etree.XML(data["arch"]) + path = "//header/button[@name='set_maintenance_stage' and @id='%s']" + button = form.xpath(path % stage.id)[0] + self.assertTrue(etree.iselement(button)) + return button + + def test_nochange(self): + self.request.set_maintenance_stage() + self.assertEqual(self.original_stage, self.request.stage_id) + + def test_form(self): + button_stage = self.get_button(self.stage) + attr_stage = json.loads(button_stage.attrib["modifiers"]) + self.assertNotIn( + self.request, + self.env["maintenance.request"].search(attr_stage["invisible"]), + ) + button = self.get_button(self.last_stage) + attr = json.loads(button.attrib["modifiers"]) + self.assertIn( + self.request, self.env["maintenance.request"].search(attr["invisible"]) + ) + getattr( + self.request.with_context(**json.loads(button_stage.attrib["context"])), + button.attrib["name"], + )() + self.request.env.invalidate_all() + self.assertEqual(self.request.stage_id, self.stage) + self.assertIn( + self.request, + self.env["maintenance.request"].search(attr_stage["invisible"]), + ) + self.assertNotIn( + self.request, self.env["maintenance.request"].search(attr["invisible"]) + ) diff --git a/maintenance_request_stage_transition/views/maintenance_request.xml b/maintenance_request_stage_transition/views/maintenance_request.xml new file mode 100644 index 000000000..4e764d014 --- /dev/null +++ b/maintenance_request_stage_transition/views/maintenance_request.xml @@ -0,0 +1,17 @@ + + + + + maintenance.request.tree (in maintenance_request_flow) + maintenance.request + + + + + + + + diff --git a/maintenance_request_stage_transition/views/maintenance_stage.xml b/maintenance_request_stage_transition/views/maintenance_stage.xml new file mode 100644 index 000000000..0502672a2 --- /dev/null +++ b/maintenance_request_stage_transition/views/maintenance_stage.xml @@ -0,0 +1,20 @@ + + + + + maintenance.stage.tree (in maintenance_request_flow) + maintenance.stage + + + + + + + + + diff --git a/setup/maintenance_request_stage_transition/odoo/addons/maintenance_request_stage_transition b/setup/maintenance_request_stage_transition/odoo/addons/maintenance_request_stage_transition new file mode 120000 index 000000000..481dcd8da --- /dev/null +++ b/setup/maintenance_request_stage_transition/odoo/addons/maintenance_request_stage_transition @@ -0,0 +1 @@ +../../../../maintenance_request_stage_transition \ No newline at end of file diff --git a/setup/maintenance_request_stage_transition/setup.py b/setup/maintenance_request_stage_transition/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/maintenance_request_stage_transition/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)