From c64fd860f21f41c2c3bbc728bc60782cc281f554 Mon Sep 17 00:00:00 2001 From: Enric Tobella Date: Wed, 4 Dec 2019 18:43:28 +0100 Subject: [PATCH 01/21] [11.0][ADD] maintenance_request_stage_transition [UPD] Update maintenance_request_stage_transition.pot --- .../README.rst | 91 ++++ .../__init__.py | 1 + .../__manifest__.py | 22 + .../i18n/es.po | 78 ++++ .../maintenance_request_stage_transition.pot | 76 +++ .../models/__init__.py | 2 + .../models/maintenance_request.py | 49 ++ .../models/maintenance_stage.py | 57 +++ .../readme/CONTRIBUTORS.rst | 2 + .../readme/DESCRIPTION.rst | 1 + .../readme/USAGE.rst | 5 + .../static/description/icon.png | Bin 0 -> 9455 bytes .../static/description/index.html | 433 ++++++++++++++++++ .../tests/__init__.py | 1 + .../tests/test_flow.py | 71 +++ .../views/maintenance_request.xml | 20 + .../views/maintenance_stage.xml | 20 + 17 files changed, 929 insertions(+) create mode 100644 maintenance_request_stage_transition/README.rst create mode 100644 maintenance_request_stage_transition/__init__.py create mode 100644 maintenance_request_stage_transition/__manifest__.py create mode 100644 maintenance_request_stage_transition/i18n/es.po create mode 100644 maintenance_request_stage_transition/i18n/maintenance_request_stage_transition.pot create mode 100644 maintenance_request_stage_transition/models/__init__.py create mode 100644 maintenance_request_stage_transition/models/maintenance_request.py create mode 100644 maintenance_request_stage_transition/models/maintenance_stage.py create mode 100644 maintenance_request_stage_transition/readme/CONTRIBUTORS.rst create mode 100644 maintenance_request_stage_transition/readme/DESCRIPTION.rst create mode 100644 maintenance_request_stage_transition/readme/USAGE.rst create mode 100644 maintenance_request_stage_transition/static/description/icon.png create mode 100644 maintenance_request_stage_transition/static/description/index.html create mode 100644 maintenance_request_stage_transition/tests/__init__.py create mode 100644 maintenance_request_stage_transition/tests/test_flow.py create mode 100644 maintenance_request_stage_transition/views/maintenance_request.xml create mode 100644 maintenance_request_stage_transition/views/maintenance_stage.xml diff --git a/maintenance_request_stage_transition/README.rst b/maintenance_request_stage_transition/README.rst new file mode 100644 index 000000000..a9131042f --- /dev/null +++ b/maintenance_request_stage_transition/README.rst @@ -0,0 +1,91 @@ +==================================== +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/11.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-11-0/maintenance-11-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/11.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 + +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..02ad5eeb1 --- /dev/null +++ b/maintenance_request_stage_transition/__manifest__.py @@ -0,0 +1,22 @@ +# 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': '11.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', + ], + 'maintainers': [ + 'etobella', + ] +} diff --git a/maintenance_request_stage_transition/i18n/es.po b/maintenance_request_stage_transition/i18n/es.po new file mode 100644 index 000000000..a2c2ba794 --- /dev/null +++ b/maintenance_request_stage_transition/i18n/es.po @@ -0,0 +1,78 @@ +# 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: 2019-12-30 13:49+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 3.10\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 +#: selection:maintenance.stage,button_class:0 +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 +#: selection:maintenance.stage,button_class:0 +msgid "Info" +msgstr "Info" + +#. module: maintenance_request_stage_transition +#: model:ir.model,name:maintenance_request_stage_transition.model_maintenance_request +msgid "Maintenance Requests" +msgstr "Peticiones 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 +#: selection:maintenance.stage,button_class:0 +msgid "Primary" +msgstr "Primario" + +#. module: maintenance_request_stage_transition +#: selection:maintenance.stage,button_class:0 +msgid "Success" +msgstr "Éxito" + +#. module: maintenance_request_stage_transition +#: code:addons/maintenance_request_stage_transition/models/maintenance_stage.py:41 +#, python-format +msgid "To %s" +msgstr "A %s" + +#. module: maintenance_request_stage_transition +#: selection:maintenance.stage,button_class:0 +msgid "Warning" +msgstr "Advertencia" 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..d840720e3 --- /dev/null +++ b/maintenance_request_stage_transition/i18n/maintenance_request_stage_transition.pot @@ -0,0 +1,76 @@ +# 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" +"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 +#: selection:maintenance.stage,button_class:0 +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 +#: selection:maintenance.stage,button_class:0 +msgid "Info" +msgstr "" + +#. module: maintenance_request_stage_transition +#: model:ir.model,name:maintenance_request_stage_transition.model_maintenance_request +msgid "Maintenance Requests" +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 +#: selection:maintenance.stage,button_class:0 +msgid "Primary" +msgstr "" + +#. module: maintenance_request_stage_transition +#: selection:maintenance.stage,button_class:0 +msgid "Success" +msgstr "" + +#. module: maintenance_request_stage_transition +#: code:addons/maintenance_request_stage_transition/models/maintenance_stage.py:41 +#, python-format +msgid "To %s" +msgstr "" + +#. module: maintenance_request_stage_transition +#: selection:maintenance.stage,button_class:0 +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..36419b707 --- /dev/null +++ b/maintenance_request_stage_transition/models/maintenance_request.py @@ -0,0 +1,49 @@ +# Copyright 2019 Creu Blanca +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models +from odoo.osv.orm import setup_modifiers +from lxml import etree + + +class MaintenanceRequest(models.Model): + + _inherit = 'maintenance.request' + + stage_id = fields.Many2one( + 'maintenance.stage', + readonly=True + ) + + @api.model + def fields_view_get( + self, view_id=None, view_type="form", toolbar=False, submenu=False + ): + res = super().fields_view_get( + view_id=view_id, + view_type=view_type, + toolbar=toolbar, + submenu=submenu, + ) + 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() + 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 + }) 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..b3a5551cf --- /dev/null +++ b/maintenance_request_stage_transition/models/maintenance_stage.py @@ -0,0 +1,57 @@ +# Copyright 2019 Creu Blanca +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models, _ +from lxml import etree +import json + + +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..94e7b0a40 --- /dev/null +++ b/maintenance_request_stage_transition/readme/CONTRIBUTORS.rst @@ -0,0 +1,2 @@ +* Enric Tobella +* Jaime Arroyo 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 0000000000000000000000000000000000000000..3a0328b516c4980e8e44cdb63fd945757ddd132d GIT binary patch literal 9455 zcmW++2RxMjAAjx~&dlBk9S+%}OXg)AGE&Cb*&}d0jUxM@u(PQx^-s)697TX`ehR4?GS^qbkof1cslKgkU)h65qZ9Oc=ml_0temigYLJfnz{IDzUf>bGs4N!v3=Z3jMq&A#7%rM5eQ#dc?k~! zVpnB`o+K7|Al`Q_U;eD$B zfJtP*jH`siUq~{KE)`jP2|#TUEFGRryE2`i0**z#*^6~AI|YzIWy$Cu#CSLW3q=GA z6`?GZymC;dCPk~rBS%eCb`5OLr;RUZ;D`}um=H)BfVIq%7VhiMr)_#G0N#zrNH|__ zc+blN2UAB0=617@>_u;MPHN;P;N#YoE=)R#i$k_`UAA>WWCcEVMh~L_ zj--gtp&|K1#58Yz*AHCTMziU1Jzt_jG0I@qAOHsk$2}yTmVkBp_eHuY$A9)>P6o~I z%aQ?!(GqeQ-Y+b0I(m9pwgi(IIZZzsbMv+9w{PFtd_<_(LA~0H(xz{=FhLB@(1&qHA5EJw1>>=%q2f&^X>IQ{!GJ4e9U z&KlB)z(84HmNgm2hg2C0>WM{E(DdPr+EeU_N@57;PC2&DmGFW_9kP&%?X4}+xWi)( z;)z%wI5>D4a*5XwD)P--sPkoY(a~WBw;E~AW`Yue4kFa^LM3X`8x|}ZUeMnqr}>kH zG%WWW>3ml$Yez?i%)2pbKPI7?5o?hydokgQyZsNEr{a|mLdt;X2TX(#B1j35xPnPW z*bMSSOauW>o;*=kO8ojw91VX!qoOQb)zHJ!odWB}d+*K?#sY_jqPdg{Sm2HdYzdEx zO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UtkJiG{} zPaR&}_fn8_z~(=;5lD-aPWD3z8PZS@AaUiomF!G8I}Mf>e~0g#BelA-5#`cj;O5>N Xviia!U7SGha1wx#SCgwmn*{w2TRX*I literal 0 HcmV?d00001 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..ddb3c9b32 --- /dev/null +++ b/maintenance_request_stage_transition/static/description/index.html @@ -0,0 +1,433 @@ + + + + + + +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..2564109d6 --- /dev/null +++ b/maintenance_request_stage_transition/tests/test_flow.py @@ -0,0 +1,71 @@ +# Copyright 2019 Creu Blanca +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo.tests.common import TransactionCase +from lxml import etree +import json + + +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.fields_view_get(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['attrs']) + self.assertNotIn( + self.request, + self.env['maintenance.request'].search(attr_stage['invisible']) + ) + button = self.get_button(self.last_stage) + attr = json.loads(button.attrib['attrs']) + 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.refresh() + 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..5f2b026b4 --- /dev/null +++ b/maintenance_request_stage_transition/views/maintenance_request.xml @@ -0,0 +1,20 @@ + + + + + + + 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..cdffe4337 --- /dev/null +++ b/maintenance_request_stage_transition/views/maintenance_stage.xml @@ -0,0 +1,20 @@ + + + + + + + maintenance.stage.tree (in maintenance_request_flow) + maintenance.stage + + + + + + + + + + + From c83ead3086191d53d2a73faf7390cd11bcbc1d47 Mon Sep 17 00:00:00 2001 From: Jaime Arroyo Date: Wed, 8 Jan 2020 17:43:40 +0100 Subject: [PATCH 02/21] [12.0][MIG] maintenance_request_stage_transition --- .../README.rst | 10 +++++----- .../__manifest__.py | 2 +- .../i18n/es.po | 19 +++++++++++++------ .../maintenance_request_stage_transition.pot | 17 +++++++++++------ .../static/description/index.html | 6 +++--- 5 files changed, 33 insertions(+), 21 deletions(-) diff --git a/maintenance_request_stage_transition/README.rst b/maintenance_request_stage_transition/README.rst index a9131042f..e82199887 100644 --- a/maintenance_request_stage_transition/README.rst +++ b/maintenance_request_stage_transition/README.rst @@ -14,13 +14,13 @@ Maintenance Request Stage transition :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/11.0/maintenance_request_stage_transition + :target: https://github.com/OCA/maintenance/tree/12.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-11-0/maintenance-11-0-maintenance_request_stage_transition + :target: https://translation.odoo-community.org/projects/maintenance-12-0/maintenance-12-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/11.0 + :target: https://runbot.odoo-community.org/runbot/240/12.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -47,7 +47,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 smashing it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -86,6 +86,6 @@ Current `maintainer `__: |maintainer-etobella| -This module is part of the `OCA/maintenance `_ project on GitHub. +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/__manifest__.py b/maintenance_request_stage_transition/__manifest__.py index 02ad5eeb1..7e7376cf9 100644 --- a/maintenance_request_stage_transition/__manifest__.py +++ b/maintenance_request_stage_transition/__manifest__.py @@ -5,7 +5,7 @@ 'name': 'Maintenance Request Stage transition', 'summary': """ Manage transition visibility and management between stages""", - 'version': '11.0.1.0.0', + 'version': '12.0.1.0.0', 'license': 'AGPL-3', 'author': 'Creu Blanca,Odoo Community Association (OCA)', 'website': 'https://github.com/OCA/maintenance', diff --git a/maintenance_request_stage_transition/i18n/es.po b/maintenance_request_stage_transition/i18n/es.po index a2c2ba794..fbf37f382 100644 --- a/maintenance_request_stage_transition/i18n/es.po +++ b/maintenance_request_stage_transition/i18n/es.po @@ -1,6 +1,6 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * maintenance_request_stage_transition +# * maintenance_request_stage_transition # msgid "" msgstr "" @@ -17,7 +17,7 @@ msgstr "" "X-Generator: Weblate 3.10\n" #. module: maintenance_request_stage_transition -#: model:ir.model.fields,field_description:maintenance_request_stage_transition.field_maintenance_stage_button_class +#: model:ir.model.fields,field_description:maintenance_request_stage_transition.field_maintenance_stage__button_class msgid "Button Class" msgstr "Clase del Botón" @@ -27,7 +27,7 @@ msgid "Danger" msgstr "Peligro" #. module: maintenance_request_stage_transition -#: model:ir.model.fields,help:maintenance_request_stage_transition.field_maintenance_stage_button_class +#: 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" @@ -38,7 +38,9 @@ msgstr "Info" #. module: maintenance_request_stage_transition #: model:ir.model,name:maintenance_request_stage_transition.model_maintenance_request -msgid "Maintenance Requests" +#, fuzzy +#| msgid "Maintenance Requests" +msgid "Maintenance Request" msgstr "Peticiones de mantenimiento" #. module: maintenance_request_stage_transition @@ -47,12 +49,12 @@ 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 +#: 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 +#: model:ir.model.fields,field_description:maintenance_request_stage_transition.field_maintenance_stage__previous_stage_ids msgid "Previous stages" msgstr "Estados previos" @@ -61,6 +63,11 @@ msgstr "Estados previos" 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 #: selection:maintenance.stage,button_class:0 msgid "Success" diff --git a/maintenance_request_stage_transition/i18n/maintenance_request_stage_transition.pot b/maintenance_request_stage_transition/i18n/maintenance_request_stage_transition.pot index d840720e3..951b9c40e 100644 --- a/maintenance_request_stage_transition/i18n/maintenance_request_stage_transition.pot +++ b/maintenance_request_stage_transition/i18n/maintenance_request_stage_transition.pot @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 11.0\n" +"Project-Id-Version: Odoo Server 12.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: <>\n" "Language-Team: \n" @@ -14,7 +14,7 @@ msgstr "" "Plural-Forms: \n" #. module: maintenance_request_stage_transition -#: model:ir.model.fields,field_description:maintenance_request_stage_transition.field_maintenance_stage_button_class +#: model:ir.model.fields,field_description:maintenance_request_stage_transition.field_maintenance_stage__button_class msgid "Button Class" msgstr "" @@ -24,7 +24,7 @@ msgid "Danger" msgstr "" #. module: maintenance_request_stage_transition -#: model:ir.model.fields,help:maintenance_request_stage_transition.field_maintenance_stage_button_class +#: model:ir.model.fields,help:maintenance_request_stage_transition.field_maintenance_stage__button_class msgid "For default, the system uses primary" msgstr "" @@ -35,7 +35,7 @@ msgstr "" #. module: maintenance_request_stage_transition #: model:ir.model,name:maintenance_request_stage_transition.model_maintenance_request -msgid "Maintenance Requests" +msgid "Maintenance Request" msgstr "" #. module: maintenance_request_stage_transition @@ -44,12 +44,12 @@ 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 +#: 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 +#: model:ir.model.fields,field_description:maintenance_request_stage_transition.field_maintenance_stage__previous_stage_ids msgid "Previous stages" msgstr "" @@ -58,6 +58,11 @@ msgstr "" 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 #: selection:maintenance.stage,button_class:0 msgid "Success" diff --git a/maintenance_request_stage_transition/static/description/index.html b/maintenance_request_stage_transition/static/description/index.html index ddb3c9b32..ceba2784c 100644 --- a/maintenance_request_stage_transition/static/description/index.html +++ b/maintenance_request_stage_transition/static/description/index.html @@ -367,7 +367,7 @@

Maintenance Request Stage transition

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

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

+

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

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

+feedback.

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

@@ -424,7 +424,7 @@

Maintainers

promote its widespread use.

Current maintainer:

etobella

-

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

+

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.

From b6f5277f70b049a73afa4313aa5a48c06b2456af Mon Sep 17 00:00:00 2001 From: David Alonso Date: Sun, 5 Apr 2020 13:44:04 +0200 Subject: [PATCH 03/21] [IMP] maintenance_request_stage_transition: black, isort, prettier --- .../__manifest__.py | 25 +++----- .../models/maintenance_request.py | 29 +++------ .../models/maintenance_stage.py | 61 ++++++++++--------- .../tests/test_flow.py | 58 ++++++++---------- .../views/maintenance_request.xml | 15 ++--- .../views/maintenance_stage.xml | 18 +++--- 6 files changed, 90 insertions(+), 116 deletions(-) diff --git a/maintenance_request_stage_transition/__manifest__.py b/maintenance_request_stage_transition/__manifest__.py index 7e7376cf9..d6454cabf 100644 --- a/maintenance_request_stage_transition/__manifest__.py +++ b/maintenance_request_stage_transition/__manifest__.py @@ -2,21 +2,14 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { - 'name': 'Maintenance Request Stage transition', - 'summary': """ + "name": "Maintenance Request Stage transition", + "summary": """ Manage transition visibility and management between stages""", - 'version': '12.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', - ], - 'maintainers': [ - 'etobella', - ] + "version": "12.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",], + "maintainers": ["etobella",], } diff --git a/maintenance_request_stage_transition/models/maintenance_request.py b/maintenance_request_stage_transition/models/maintenance_request.py index 36419b707..286f9f8b3 100644 --- a/maintenance_request_stage_transition/models/maintenance_request.py +++ b/maintenance_request_stage_transition/models/maintenance_request.py @@ -1,34 +1,28 @@ # 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.osv.orm import setup_modifiers -from lxml import etree class MaintenanceRequest(models.Model): - _inherit = 'maintenance.request' + _inherit = "maintenance.request" - stage_id = fields.Many2one( - 'maintenance.stage', - readonly=True - ) + stage_id = fields.Many2one("maintenance.stage", readonly=True) @api.model def fields_view_get( - self, view_id=None, view_type="form", toolbar=False, submenu=False + self, view_id=None, view_type="form", toolbar=False, submenu=False ): res = super().fields_view_get( - view_id=view_id, - view_type=view_type, - toolbar=toolbar, - submenu=submenu, + view_id=view_id, view_type=view_type, toolbar=toolbar, submenu=submenu, ) if view_type == "form": doc = etree.XML(res["arch"]) - stages = self.env['maintenance.stage'].search( - [], order="sequence desc") + stages = self.env["maintenance.stage"].search([], order="sequence desc") header = doc.xpath("//form/header")[0] for stage in stages: node = stage._get_stage_node() @@ -38,12 +32,9 @@ def fields_view_get( return res def set_maintenance_stage(self): - if not self.env.context.get('next_stage_id'): + if not self.env.context.get("next_stage_id"): return {} - return self._set_maintenance_stage( - self.env.context.get('next_stage_id')) + 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 - }) + self.write({"stage_id": stage_id}) diff --git a/maintenance_request_stage_transition/models/maintenance_stage.py b/maintenance_request_stage_transition/models/maintenance_stage.py index b3a5551cf..9d66ae677 100644 --- a/maintenance_request_stage_transition/models/maintenance_stage.py +++ b/maintenance_request_stage_transition/models/maintenance_stage.py @@ -1,57 +1,58 @@ # Copyright 2019 Creu Blanca # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import fields, models, _ -from lxml import etree import json +from lxml import etree + +from odoo import _, fields, models + class MaintenanceStage(models.Model): - _inherit = 'maintenance.stage' + _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', + "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', + "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", ) - 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)] - } + return {"invisible": [("stage_id", "not in", self.previous_stage_ids.ids)]} def _get_stage_node_name(self): - return _('To %s') % self.name + return _("To %s") % self.name def _get_stage_node(self): return etree.Element( - 'button', + "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} - ), + "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/tests/test_flow.py b/maintenance_request_stage_transition/tests/test_flow.py index 2564109d6..c55287344 100644 --- a/maintenance_request_stage_transition/tests/test_flow.py +++ b/maintenance_request_stage_transition/tests/test_flow.py @@ -1,39 +1,32 @@ # Copyright 2019 Creu Blanca # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo.tests.common import TransactionCase -from lxml import etree import json +from lxml import etree + +from odoo.tests.common import TransactionCase -class TestFlow(TransactionCase): +class TestFlow(TransactionCase): def setUp(self): super().setUp() - self.request = self.env['maintenance.request'].create({ - 'name': 'Request' - }) + 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)], - }) + 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 - ) + self.assertIn(self.original_stage, self.stage.previous_stage_ids) def get_button(self, stage): - data = self.request.fields_view_get(view_type='form') - form = etree.XML(data['arch']) + data = self.request.fields_view_get(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)) @@ -45,27 +38,26 @@ def test_nochange(self): def test_form(self): button_stage = self.get_button(self.stage) - attr_stage = json.loads(button_stage.attrib['attrs']) + attr_stage = json.loads(button_stage.attrib["attrs"]) self.assertNotIn( self.request, - self.env['maintenance.request'].search(attr_stage['invisible']) + self.env["maintenance.request"].search(attr_stage["invisible"]), ) button = self.get_button(self.last_stage) - attr = json.loads(button.attrib['attrs']) + attr = json.loads(button.attrib["attrs"]) self.assertIn( - self.request, - self.env['maintenance.request'].search(attr['invisible']) + self.request, self.env["maintenance.request"].search(attr["invisible"]) ) - getattr(self.request.with_context( - json.loads(button_stage.attrib['context']) - ), button.attrib['name'])() + getattr( + self.request.with_context(json.loads(button_stage.attrib["context"])), + button.attrib["name"], + )() self.request.refresh() self.assertEqual(self.request.stage_id, self.stage) self.assertIn( self.request, - self.env['maintenance.request'].search(attr_stage['invisible']) + self.env["maintenance.request"].search(attr_stage["invisible"]), ) self.assertNotIn( - self.request, - self.env['maintenance.request'].search(attr['invisible']) + 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 index 5f2b026b4..4e764d014 100644 --- a/maintenance_request_stage_transition/views/maintenance_request.xml +++ b/maintenance_request_stage_transition/views/maintenance_request.xml @@ -1,20 +1,17 @@ - + - - - maintenance.request.tree (in maintenance_request_flow) + 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 index cdffe4337..0502672a2 100644 --- a/maintenance_request_stage_transition/views/maintenance_stage.xml +++ b/maintenance_request_stage_transition/views/maintenance_stage.xml @@ -1,20 +1,20 @@ - + - - maintenance.stage.tree (in maintenance_request_flow) maintenance.stage - + - - + + + - - - From 6860ab7e946ef6cdb58aba0ee7b4e2066525b6ec Mon Sep 17 00:00:00 2001 From: David Alonso Date: Sun, 5 Apr 2020 20:58:44 +0200 Subject: [PATCH 04/21] [MIG] maintenance_request_stage_transition: Migration to 13.0 [UPD] Update maintenance_request_stage_transition.pot Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: maintenance-13.0/maintenance-13.0-maintenance_request_stage_transition Translate-URL: https://translation.odoo-community.org/projects/maintenance-13-0/maintenance-13-0-maintenance_request_stage_transition/ Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: maintenance-13.0/maintenance-13.0-maintenance_request_stage_transition Translate-URL: https://translation.odoo-community.org/projects/maintenance-13-0/maintenance-13-0-maintenance_request_stage_transition/ --- .../README.rst | 11 +++++----- .../__manifest__.py | 7 ++++--- ...o_maintenance_request_stage_transition.xml | 21 +++++++++++++++++++ .../i18n/es.po | 13 ++++++------ .../maintenance_request_stage_transition.pot | 19 ++++++++--------- .../models/maintenance_request.py | 11 ++++++++-- .../readme/CONTRIBUTORS.rst | 1 + .../static/description/index.html | 7 ++++--- .../tests/test_flow.py | 8 +++---- 9 files changed, 63 insertions(+), 35 deletions(-) create mode 100644 maintenance_request_stage_transition/data/demo_maintenance_request_stage_transition.xml diff --git a/maintenance_request_stage_transition/README.rst b/maintenance_request_stage_transition/README.rst index e82199887..0b622f6b5 100644 --- a/maintenance_request_stage_transition/README.rst +++ b/maintenance_request_stage_transition/README.rst @@ -14,13 +14,13 @@ Maintenance Request Stage transition :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/12.0/maintenance_request_stage_transition + :target: https://github.com/OCA/maintenance/tree/13.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-12-0/maintenance-12-0-maintenance_request_stage_transition + :target: https://translation.odoo-community.org/projects/maintenance-13-0/maintenance-13-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/12.0 + :target: https://runbot.odoo-community.org/runbot/240/13.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -47,7 +47,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 smashing it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -64,6 +64,7 @@ Contributors * Enric Tobella * Jaime Arroyo +* David Alonso Maintainers ~~~~~~~~~~~ @@ -86,6 +87,6 @@ Current `maintainer `__: |maintainer-etobella| -This module is part of the `OCA/maintenance `_ project on GitHub. +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/__manifest__.py b/maintenance_request_stage_transition/__manifest__.py index d6454cabf..71737f6c9 100644 --- a/maintenance_request_stage_transition/__manifest__.py +++ b/maintenance_request_stage_transition/__manifest__.py @@ -5,11 +5,12 @@ "name": "Maintenance Request Stage transition", "summary": """ Manage transition visibility and management between stages""", - "version": "12.0.1.0.0", + "version": "13.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",], - "maintainers": ["etobella",], + "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..202ecfdd1 --- /dev/null +++ b/maintenance_request_stage_transition/data/demo_maintenance_request_stage_transition.xml @@ -0,0 +1,21 @@ + + + + info + + + + warning + + + + success + + + danger + + + diff --git a/maintenance_request_stage_transition/i18n/es.po b/maintenance_request_stage_transition/i18n/es.po index fbf37f382..e2a860ce4 100644 --- a/maintenance_request_stage_transition/i18n/es.po +++ b/maintenance_request_stage_transition/i18n/es.po @@ -22,7 +22,7 @@ msgid "Button Class" msgstr "Clase del Botón" #. module: maintenance_request_stage_transition -#: selection:maintenance.stage,button_class:0 +#: model:ir.model.fields.selection,name:maintenance_request_stage_transition.selection__maintenance_stage__button_class__danger msgid "Danger" msgstr "Peligro" @@ -32,14 +32,13 @@ msgid "For default, the system uses primary" msgstr "Por defecto, el sistema usa Primario" #. module: maintenance_request_stage_transition -#: selection:maintenance.stage,button_class:0 +#: 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 #, fuzzy -#| msgid "Maintenance Requests" msgid "Maintenance Request" msgstr "Peticiones de mantenimiento" @@ -59,7 +58,7 @@ msgid "Previous stages" msgstr "Estados previos" #. module: maintenance_request_stage_transition -#: selection:maintenance.stage,button_class:0 +#: model:ir.model.fields.selection,name:maintenance_request_stage_transition.selection__maintenance_stage__button_class__primary msgid "Primary" msgstr "Primario" @@ -69,17 +68,17 @@ msgid "Stage" msgstr "" #. module: maintenance_request_stage_transition -#: selection:maintenance.stage,button_class:0 +#: 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:41 +#: code:addons/maintenance_request_stage_transition/models/maintenance_stage.py:0 #, python-format msgid "To %s" msgstr "A %s" #. module: maintenance_request_stage_transition -#: selection:maintenance.stage,button_class:0 +#: 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/maintenance_request_stage_transition.pot b/maintenance_request_stage_transition/i18n/maintenance_request_stage_transition.pot index 951b9c40e..27e993968 100644 --- a/maintenance_request_stage_transition/i18n/maintenance_request_stage_transition.pot +++ b/maintenance_request_stage_transition/i18n/maintenance_request_stage_transition.pot @@ -1,12 +1,12 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * maintenance_request_stage_transition +# * maintenance_request_stage_transition # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 12.0\n" +"Project-Id-Version: Odoo Server 13.0\n" "Report-Msgid-Bugs-To: \n" -"Last-Translator: <>\n" +"Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -19,7 +19,7 @@ msgid "Button Class" msgstr "" #. module: maintenance_request_stage_transition -#: selection:maintenance.stage,button_class:0 +#: model:ir.model.fields.selection,name:maintenance_request_stage_transition.selection__maintenance_stage__button_class__danger msgid "Danger" msgstr "" @@ -29,7 +29,7 @@ msgid "For default, the system uses primary" msgstr "" #. module: maintenance_request_stage_transition -#: selection:maintenance.stage,button_class:0 +#: model:ir.model.fields.selection,name:maintenance_request_stage_transition.selection__maintenance_stage__button_class__info msgid "Info" msgstr "" @@ -54,7 +54,7 @@ msgid "Previous stages" msgstr "" #. module: maintenance_request_stage_transition -#: selection:maintenance.stage,button_class:0 +#: model:ir.model.fields.selection,name:maintenance_request_stage_transition.selection__maintenance_stage__button_class__primary msgid "Primary" msgstr "" @@ -64,18 +64,17 @@ msgid "Stage" msgstr "" #. module: maintenance_request_stage_transition -#: selection:maintenance.stage,button_class:0 +#: 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:41 +#: code:addons/maintenance_request_stage_transition/models/maintenance_stage.py:0 #, python-format msgid "To %s" msgstr "" #. module: maintenance_request_stage_transition -#: selection:maintenance.stage,button_class:0 +#: 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/maintenance_request.py b/maintenance_request_stage_transition/models/maintenance_request.py index 286f9f8b3..dc9bb7ffd 100644 --- a/maintenance_request_stage_transition/models/maintenance_request.py +++ b/maintenance_request_stage_transition/models/maintenance_request.py @@ -4,7 +4,8 @@ from lxml import etree from odoo import api, fields, models -from odoo.osv.orm import setup_modifiers + +from odoo.addons.base.models import ir_ui_view class MaintenanceRequest(models.Model): @@ -26,7 +27,7 @@ def fields_view_get( header = doc.xpath("//form/header")[0] for stage in stages: node = stage._get_stage_node() - setup_modifiers(node) + self._setup_modifiers(node) header.insert(0, node) res["arch"] = etree.tostring(doc, encoding="unicode") return res @@ -38,3 +39,9 @@ def set_maintenance_stage(self): 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/readme/CONTRIBUTORS.rst b/maintenance_request_stage_transition/readme/CONTRIBUTORS.rst index 94e7b0a40..73abe2903 100644 --- a/maintenance_request_stage_transition/readme/CONTRIBUTORS.rst +++ b/maintenance_request_stage_transition/readme/CONTRIBUTORS.rst @@ -1,2 +1,3 @@ * Enric Tobella * Jaime Arroyo +* David Alonso diff --git a/maintenance_request_stage_transition/static/description/index.html b/maintenance_request_stage_transition/static/description/index.html index ceba2784c..8360f6538 100644 --- a/maintenance_request_stage_transition/static/description/index.html +++ b/maintenance_request_stage_transition/static/description/index.html @@ -367,7 +367,7 @@

Maintenance Request Stage transition

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

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

+

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

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

+feedback.

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

@@ -413,6 +413,7 @@

Contributors

@@ -424,7 +425,7 @@

Maintainers

promote its widespread use.

Current maintainer:

etobella

-

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

+

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/test_flow.py b/maintenance_request_stage_transition/tests/test_flow.py index c55287344..e023b78b6 100644 --- a/maintenance_request_stage_transition/tests/test_flow.py +++ b/maintenance_request_stage_transition/tests/test_flow.py @@ -13,13 +13,11 @@ 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.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)],} + {"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) From 38d6eb388298d6b57290340d2747bbae9d3f17f3 Mon Sep 17 00:00:00 2001 From: Enric Tobella Date: Wed, 14 Jul 2021 12:54:32 +0000 Subject: [PATCH 05/21] Translated using Weblate (Spanish) Currently translated at 92.3% (12 of 13 strings) Translation: maintenance-13.0/maintenance-13.0-maintenance_request_stage_transition Translate-URL: https://translation.odoo-community.org/projects/maintenance-13-0/maintenance-13-0-maintenance_request_stage_transition/es/ --- maintenance_request_stage_transition/i18n/es.po | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/maintenance_request_stage_transition/i18n/es.po b/maintenance_request_stage_transition/i18n/es.po index e2a860ce4..eb8138edc 100644 --- a/maintenance_request_stage_transition/i18n/es.po +++ b/maintenance_request_stage_transition/i18n/es.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 11.0\n" "Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2019-12-30 13:49+0000\n" +"PO-Revision-Date: 2021-07-14 15:48+0000\n" "Last-Translator: Enric Tobella \n" "Language-Team: none\n" "Language: es\n" @@ -14,7 +14,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 3.10\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 @@ -38,9 +38,8 @@ msgstr "Info" #. module: maintenance_request_stage_transition #: model:ir.model,name:maintenance_request_stage_transition.model_maintenance_request -#, fuzzy msgid "Maintenance Request" -msgstr "Peticiones de mantenimiento" +msgstr "Petición de mantenimiento" #. module: maintenance_request_stage_transition #: model:ir.model,name:maintenance_request_stage_transition.model_maintenance_stage From c92118eb49e24b2a1cd8f414381436394ddb3b96 Mon Sep 17 00:00:00 2001 From: mymage Date: Wed, 28 Jul 2021 07:15:22 +0000 Subject: [PATCH 06/21] Added translation using Weblate (Italian) --- .../i18n/it.po | 81 +++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 maintenance_request_stage_transition/i18n/it.po diff --git a/maintenance_request_stage_transition/i18n/it.po b/maintenance_request_stage_transition/i18n/it.po new file mode 100644 index 000000000..ba7b80e00 --- /dev/null +++ b/maintenance_request_stage_transition/i18n/it.po @@ -0,0 +1,81 @@ +# 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" +"Last-Translator: Automatically generated\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" + +#. 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 "" From 406c1b215693051b971e1eb216a955cd54557063 Mon Sep 17 00:00:00 2001 From: mymage Date: Wed, 28 Jul 2021 07:18:50 +0000 Subject: [PATCH 07/21] Translated using Weblate (Italian) Currently translated at 100.0% (13 of 13 strings) Translation: maintenance-13.0/maintenance-13.0-maintenance_request_stage_transition Translate-URL: https://translation.odoo-community.org/projects/maintenance-13-0/maintenance-13-0-maintenance_request_stage_transition/it/ --- .../i18n/it.po | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/maintenance_request_stage_transition/i18n/it.po b/maintenance_request_stage_transition/i18n/it.po index ba7b80e00..89e543f39 100644 --- a/maintenance_request_stage_transition/i18n/it.po +++ b/maintenance_request_stage_transition/i18n/it.po @@ -6,76 +6,78 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 13.0\n" "Report-Msgid-Bugs-To: \n" -"Last-Translator: Automatically generated\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 "" +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 "" +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 "" +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 "" +msgstr "Informazioni" #. module: maintenance_request_stage_transition #: model:ir.model,name:maintenance_request_stage_transition.model_maintenance_request msgid "Maintenance Request" -msgstr "" +msgstr "Richiesta manutenzione" #. module: maintenance_request_stage_transition #: model:ir.model,name:maintenance_request_stage_transition.model_maintenance_stage msgid "Maintenance Stage" -msgstr "" +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 "" +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 "" +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 "" +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 "" +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 "" +msgstr "Successo" #. module: maintenance_request_stage_transition #: code:addons/maintenance_request_stage_transition/models/maintenance_stage.py:0 #, python-format msgid "To %s" -msgstr "" +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 "" +msgstr "Attenzione" From f668d4f6301ced11ad6b8806645e5cc0b39a8df3 Mon Sep 17 00:00:00 2001 From: mariadforgeflow Date: Thu, 19 Aug 2021 10:34:13 +0200 Subject: [PATCH 08/21] [IMP] maintenance_request_stage_transition: black, isort, prettier --- .../models/maintenance_request.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/maintenance_request_stage_transition/models/maintenance_request.py b/maintenance_request_stage_transition/models/maintenance_request.py index dc9bb7ffd..33bf4e686 100644 --- a/maintenance_request_stage_transition/models/maintenance_request.py +++ b/maintenance_request_stage_transition/models/maintenance_request.py @@ -19,7 +19,10 @@ def fields_view_get( self, view_id=None, view_type="form", toolbar=False, submenu=False ): res = super().fields_view_get( - view_id=view_id, view_type=view_type, toolbar=toolbar, submenu=submenu, + view_id=view_id, + view_type=view_type, + toolbar=toolbar, + submenu=submenu, ) if view_type == "form": doc = etree.XML(res["arch"]) From a24043978ce4bede847ca75cfaa72c182478e1c5 Mon Sep 17 00:00:00 2001 From: mariadforgeflow Date: Thu, 19 Aug 2021 10:48:56 +0200 Subject: [PATCH 09/21] [MIG] maintenance_request_stage_transition: Migration to 14.0 [UPD] Update maintenance_request_stage_transition.pot [UPD] README.rst --- .../README.rst | 10 +++++----- .../__manifest__.py | 2 +- .../maintenance_request_stage_transition.pot | 20 ++++++++++++++++++- .../static/description/index.html | 6 +++--- 4 files changed, 28 insertions(+), 10 deletions(-) diff --git a/maintenance_request_stage_transition/README.rst b/maintenance_request_stage_transition/README.rst index 0b622f6b5..9402f2938 100644 --- a/maintenance_request_stage_transition/README.rst +++ b/maintenance_request_stage_transition/README.rst @@ -14,13 +14,13 @@ Maintenance Request Stage transition :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/13.0/maintenance_request_stage_transition + :target: https://github.com/OCA/maintenance/tree/14.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-13-0/maintenance-13-0-maintenance_request_stage_transition + :target: https://translation.odoo-community.org/projects/maintenance-14-0/maintenance-14-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/13.0 + :target: https://runbot.odoo-community.org/runbot/240/14.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -47,7 +47,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 smashing it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -87,6 +87,6 @@ Current `maintainer `__: |maintainer-etobella| -This module is part of the `OCA/maintenance `_ project on GitHub. +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/__manifest__.py b/maintenance_request_stage_transition/__manifest__.py index 71737f6c9..05e226f27 100644 --- a/maintenance_request_stage_transition/__manifest__.py +++ b/maintenance_request_stage_transition/__manifest__.py @@ -5,7 +5,7 @@ "name": "Maintenance Request Stage transition", "summary": """ Manage transition visibility and management between stages""", - "version": "13.0.1.0.0", + "version": "14.0.1.0.0", "license": "AGPL-3", "author": "Creu Blanca,Odoo Community Association (OCA)", "website": "https://github.com/OCA/maintenance", diff --git a/maintenance_request_stage_transition/i18n/maintenance_request_stage_transition.pot b/maintenance_request_stage_transition/i18n/maintenance_request_stage_transition.pot index 27e993968..3d1d0d035 100644 --- a/maintenance_request_stage_transition/i18n/maintenance_request_stage_transition.pot +++ b/maintenance_request_stage_transition/i18n/maintenance_request_stage_transition.pot @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 13.0\n" +"Project-Id-Version: Odoo Server 14.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: \n" "Language-Team: \n" @@ -23,16 +23,34 @@ msgstr "" msgid "Danger" msgstr "" +#. module: maintenance_request_stage_transition +#: model:ir.model.fields,field_description:maintenance_request_stage_transition.field_maintenance_request__display_name +#: model:ir.model.fields,field_description:maintenance_request_stage_transition.field_maintenance_stage__display_name +msgid "Display Name" +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,field_description:maintenance_request_stage_transition.field_maintenance_request__id +#: model:ir.model.fields,field_description:maintenance_request_stage_transition.field_maintenance_stage__id +msgid "ID" +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.fields,field_description:maintenance_request_stage_transition.field_maintenance_request____last_update +#: model:ir.model.fields,field_description:maintenance_request_stage_transition.field_maintenance_stage____last_update +msgid "Last Modified on" +msgstr "" + #. module: maintenance_request_stage_transition #: model:ir.model,name:maintenance_request_stage_transition.model_maintenance_request msgid "Maintenance Request" diff --git a/maintenance_request_stage_transition/static/description/index.html b/maintenance_request_stage_transition/static/description/index.html index 8360f6538..dd7209db7 100644 --- a/maintenance_request_stage_transition/static/description/index.html +++ b/maintenance_request_stage_transition/static/description/index.html @@ -367,7 +367,7 @@

Maintenance Request Stage transition

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

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

+

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

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

+feedback.

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

@@ -425,7 +425,7 @@

Maintainers

promote its widespread use.

Current maintainer:

etobella

-

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

+

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.

From 96ba6088f70e0ed8ab7e6e5ed6ad3d043a225c14 Mon Sep 17 00:00:00 2001 From: Olga Marco Date: Fri, 20 May 2022 10:32:49 +0200 Subject: [PATCH 10/21] [MIG] maintenance_request_stage_transition: Migration to 15.0 --- maintenance_request_stage_transition/__manifest__.py | 2 +- .../data/demo_maintenance_request_stage_transition.xml | 10 ++++------ .../tests/test_flow.py | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/maintenance_request_stage_transition/__manifest__.py b/maintenance_request_stage_transition/__manifest__.py index 05e226f27..1348ee38a 100644 --- a/maintenance_request_stage_transition/__manifest__.py +++ b/maintenance_request_stage_transition/__manifest__.py @@ -5,7 +5,7 @@ "name": "Maintenance Request Stage transition", "summary": """ Manage transition visibility and management between stages""", - "version": "14.0.1.0.0", + "version": "15.0.1.0.0", "license": "AGPL-3", "author": "Creu Blanca,Odoo Community Association (OCA)", "website": "https://github.com/OCA/maintenance", 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 index 202ecfdd1..756abfa12 100644 --- a/maintenance_request_stage_transition/data/demo_maintenance_request_stage_transition.xml +++ b/maintenance_request_stage_transition/data/demo_maintenance_request_stage_transition.xml @@ -1,5 +1,4 @@ - - + info @@ -7,9 +6,9 @@ warning + name="next_stage_ids" + eval="[(4, ref('maintenance.stage_3')), (4, ref('maintenance.stage_4'))]" + /> success @@ -17,5 +16,4 @@ danger - diff --git a/maintenance_request_stage_transition/tests/test_flow.py b/maintenance_request_stage_transition/tests/test_flow.py index e023b78b6..547de1749 100644 --- a/maintenance_request_stage_transition/tests/test_flow.py +++ b/maintenance_request_stage_transition/tests/test_flow.py @@ -47,7 +47,7 @@ def test_form(self): self.request, self.env["maintenance.request"].search(attr["invisible"]) ) getattr( - self.request.with_context(json.loads(button_stage.attrib["context"])), + self.request.with_context(**json.loads(button_stage.attrib["context"])), button.attrib["name"], )() self.request.refresh() From e177c8e27088df713cd20285142f9e1c192c3b82 Mon Sep 17 00:00:00 2001 From: oca-ci Date: Tue, 12 Jul 2022 15:25:23 +0000 Subject: [PATCH 11/21] [UPD] Update maintenance_request_stage_transition.pot --- .../maintenance_request_stage_transition.pot | 20 +------------------ 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/maintenance_request_stage_transition/i18n/maintenance_request_stage_transition.pot b/maintenance_request_stage_transition/i18n/maintenance_request_stage_transition.pot index 3d1d0d035..fe6d13141 100644 --- a/maintenance_request_stage_transition/i18n/maintenance_request_stage_transition.pot +++ b/maintenance_request_stage_transition/i18n/maintenance_request_stage_transition.pot @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 14.0\n" +"Project-Id-Version: Odoo Server 15.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: \n" "Language-Team: \n" @@ -23,34 +23,16 @@ msgstr "" msgid "Danger" msgstr "" -#. module: maintenance_request_stage_transition -#: model:ir.model.fields,field_description:maintenance_request_stage_transition.field_maintenance_request__display_name -#: model:ir.model.fields,field_description:maintenance_request_stage_transition.field_maintenance_stage__display_name -msgid "Display Name" -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,field_description:maintenance_request_stage_transition.field_maintenance_request__id -#: model:ir.model.fields,field_description:maintenance_request_stage_transition.field_maintenance_stage__id -msgid "ID" -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.fields,field_description:maintenance_request_stage_transition.field_maintenance_request____last_update -#: model:ir.model.fields,field_description:maintenance_request_stage_transition.field_maintenance_stage____last_update -msgid "Last Modified on" -msgstr "" - #. module: maintenance_request_stage_transition #: model:ir.model,name:maintenance_request_stage_transition.model_maintenance_request msgid "Maintenance Request" From 6297d452767ab90b96565368b69c06ab4d4c21b5 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Tue, 12 Jul 2022 15:28:36 +0000 Subject: [PATCH 12/21] [UPD] README.rst --- maintenance_request_stage_transition/README.rst | 10 +++++----- .../static/description/index.html | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/maintenance_request_stage_transition/README.rst b/maintenance_request_stage_transition/README.rst index 9402f2938..47a9d0eb9 100644 --- a/maintenance_request_stage_transition/README.rst +++ b/maintenance_request_stage_transition/README.rst @@ -14,13 +14,13 @@ Maintenance Request Stage transition :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/14.0/maintenance_request_stage_transition + :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-14-0/maintenance-14-0-maintenance_request_stage_transition + :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/14.0 + :target: https://runbot.odoo-community.org/runbot/240/15.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -47,7 +47,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 smashing it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -87,6 +87,6 @@ Current `maintainer `__: |maintainer-etobella| -This module is part of the `OCA/maintenance `_ project on GitHub. +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/static/description/index.html b/maintenance_request_stage_transition/static/description/index.html index dd7209db7..9bd58c5d8 100644 --- a/maintenance_request_stage_transition/static/description/index.html +++ b/maintenance_request_stage_transition/static/description/index.html @@ -367,7 +367,7 @@

Maintenance Request Stage transition

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

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

+

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

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

+feedback.

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

@@ -425,7 +425,7 @@

Maintainers

promote its widespread use.

Current maintainer:

etobella

-

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

+

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.

From 50a2fe5522663e85e33ff1000c0dc94bfe79e7fa Mon Sep 17 00:00:00 2001 From: kaynnan Date: Mon, 3 Jul 2023 15:13:43 -0300 Subject: [PATCH 13/21] [MIG] maintenance_request_stage_transition: Migration to 16.0 --- maintenance_request_stage_transition/__manifest__.py | 2 +- .../models/maintenance_request.py | 11 ++--------- .../tests/test_flow.py | 8 ++++---- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/maintenance_request_stage_transition/__manifest__.py b/maintenance_request_stage_transition/__manifest__.py index 1348ee38a..143c56a4c 100644 --- a/maintenance_request_stage_transition/__manifest__.py +++ b/maintenance_request_stage_transition/__manifest__.py @@ -5,7 +5,7 @@ "name": "Maintenance Request Stage transition", "summary": """ Manage transition visibility and management between stages""", - "version": "15.0.1.0.0", + "version": "16.0.1.0.0", "license": "AGPL-3", "author": "Creu Blanca,Odoo Community Association (OCA)", "website": "https://github.com/OCA/maintenance", diff --git a/maintenance_request_stage_transition/models/maintenance_request.py b/maintenance_request_stage_transition/models/maintenance_request.py index 33bf4e686..997d39c9d 100644 --- a/maintenance_request_stage_transition/models/maintenance_request.py +++ b/maintenance_request_stage_transition/models/maintenance_request.py @@ -15,15 +15,8 @@ class MaintenanceRequest(models.Model): stage_id = fields.Many2one("maintenance.stage", readonly=True) @api.model - def fields_view_get( - self, view_id=None, view_type="form", toolbar=False, submenu=False - ): - res = super().fields_view_get( - view_id=view_id, - view_type=view_type, - toolbar=toolbar, - submenu=submenu, - ) + 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") diff --git a/maintenance_request_stage_transition/tests/test_flow.py b/maintenance_request_stage_transition/tests/test_flow.py index 547de1749..c622803e2 100644 --- a/maintenance_request_stage_transition/tests/test_flow.py +++ b/maintenance_request_stage_transition/tests/test_flow.py @@ -23,7 +23,7 @@ def test_inverse(self): self.assertIn(self.original_stage, self.stage.previous_stage_ids) def get_button(self, stage): - data = self.request.fields_view_get(view_type="form") + 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] @@ -36,13 +36,13 @@ def test_nochange(self): def test_form(self): button_stage = self.get_button(self.stage) - attr_stage = json.loads(button_stage.attrib["attrs"]) + 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["attrs"]) + attr = json.loads(button.attrib["modifiers"]) self.assertIn( self.request, self.env["maintenance.request"].search(attr["invisible"]) ) @@ -50,7 +50,7 @@ def test_form(self): self.request.with_context(**json.loads(button_stage.attrib["context"])), button.attrib["name"], )() - self.request.refresh() + self.request.env.invalidate_all() self.assertEqual(self.request.stage_id, self.stage) self.assertIn( self.request, From 259a3068a91cf752bde35a5f53d35ce837f83ceb Mon Sep 17 00:00:00 2001 From: oca-ci Date: Wed, 5 Jul 2023 21:35:53 +0000 Subject: [PATCH 14/21] [UPD] Update maintenance_request_stage_transition.pot --- .../i18n/maintenance_request_stage_transition.pot | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/maintenance_request_stage_transition/i18n/maintenance_request_stage_transition.pot b/maintenance_request_stage_transition/i18n/maintenance_request_stage_transition.pot index fe6d13141..bfd74fc1a 100644 --- a/maintenance_request_stage_transition/i18n/maintenance_request_stage_transition.pot +++ b/maintenance_request_stage_transition/i18n/maintenance_request_stage_transition.pot @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 15.0\n" +"Project-Id-Version: Odoo Server 16.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: \n" "Language-Team: \n" @@ -69,6 +69,7 @@ msgid "Success" msgstr "" #. module: maintenance_request_stage_transition +#. odoo-python #: code:addons/maintenance_request_stage_transition/models/maintenance_stage.py:0 #, python-format msgid "To %s" From b211c7eed3907fcad5b0797b53801ee44894f9cc Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Wed, 5 Jul 2023 21:38:00 +0000 Subject: [PATCH 15/21] [UPD] README.rst --- maintenance_request_stage_transition/README.rst | 10 +++++----- .../static/description/index.html | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/maintenance_request_stage_transition/README.rst b/maintenance_request_stage_transition/README.rst index 47a9d0eb9..3d022177b 100644 --- a/maintenance_request_stage_transition/README.rst +++ b/maintenance_request_stage_transition/README.rst @@ -14,13 +14,13 @@ Maintenance Request Stage transition :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 + :target: https://github.com/OCA/maintenance/tree/16.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 + :target: https://translation.odoo-community.org/projects/maintenance-16-0/maintenance-16-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 + :target: https://runbot.odoo-community.org/runbot/240/16.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -47,7 +47,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 smashing it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -87,6 +87,6 @@ Current `maintainer `__: |maintainer-etobella| -This module is part of the `OCA/maintenance `_ project on GitHub. +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/static/description/index.html b/maintenance_request_stage_transition/static/description/index.html index 9bd58c5d8..bda39f76c 100644 --- a/maintenance_request_stage_transition/static/description/index.html +++ b/maintenance_request_stage_transition/static/description/index.html @@ -367,7 +367,7 @@

Maintenance Request Stage transition

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

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

+

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

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

+feedback.

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

@@ -425,7 +425,7 @@

Maintainers

promote its widespread use.

Current maintainer:

etobella

-

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

+

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.

From be22b58bbdc3c358c8bd70ccf35a9984ebbfe948 Mon Sep 17 00:00:00 2001 From: Weblate Date: Wed, 5 Jul 2023 23:44:53 +0000 Subject: [PATCH 16/21] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: maintenance-16.0/maintenance-16.0-maintenance_request_stage_transition Translate-URL: https://translation.odoo-community.org/projects/maintenance-16-0/maintenance-16-0-maintenance_request_stage_transition/ --- maintenance_request_stage_transition/i18n/es.po | 1 + maintenance_request_stage_transition/i18n/it.po | 1 + 2 files changed, 2 insertions(+) diff --git a/maintenance_request_stage_transition/i18n/es.po b/maintenance_request_stage_transition/i18n/es.po index eb8138edc..7836d7f16 100644 --- a/maintenance_request_stage_transition/i18n/es.po +++ b/maintenance_request_stage_transition/i18n/es.po @@ -72,6 +72,7 @@ msgid "Success" msgstr "Éxito" #. module: maintenance_request_stage_transition +#. odoo-python #: code:addons/maintenance_request_stage_transition/models/maintenance_stage.py:0 #, python-format msgid "To %s" diff --git a/maintenance_request_stage_transition/i18n/it.po b/maintenance_request_stage_transition/i18n/it.po index 89e543f39..a3d595315 100644 --- a/maintenance_request_stage_transition/i18n/it.po +++ b/maintenance_request_stage_transition/i18n/it.po @@ -72,6 +72,7 @@ msgid "Success" msgstr "Successo" #. module: maintenance_request_stage_transition +#. odoo-python #: code:addons/maintenance_request_stage_transition/models/maintenance_stage.py:0 #, python-format msgid "To %s" From ca4fc5f6ac050c4ef8cfe09907c2102ae563fc5b Mon Sep 17 00:00:00 2001 From: Ivorra78 Date: Sat, 22 Jul 2023 20:41:05 +0000 Subject: [PATCH 17/21] Translated using Weblate (Spanish) Currently translated at 100.0% (13 of 13 strings) Translation: maintenance-16.0/maintenance-16.0-maintenance_request_stage_transition Translate-URL: https://translation.odoo-community.org/projects/maintenance-16-0/maintenance-16-0-maintenance_request_stage_transition/es/ --- maintenance_request_stage_transition/i18n/es.po | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/maintenance_request_stage_transition/i18n/es.po b/maintenance_request_stage_transition/i18n/es.po index 7836d7f16..a5f8b2256 100644 --- a/maintenance_request_stage_transition/i18n/es.po +++ b/maintenance_request_stage_transition/i18n/es.po @@ -6,15 +6,15 @@ 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" +"PO-Revision-Date: 2023-07-22 23:09+0000\n" +"Last-Translator: Ivorra78 \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" +"X-Generator: Weblate 4.17\n" #. module: maintenance_request_stage_transition #: model:ir.model.fields,field_description:maintenance_request_stage_transition.field_maintenance_stage__button_class @@ -64,7 +64,7 @@ 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 "" +msgstr "Etapa/fase" #. module: maintenance_request_stage_transition #: model:ir.model.fields.selection,name:maintenance_request_stage_transition.selection__maintenance_stage__button_class__success From bccb52c840bb1c40e34c31323971d6d2be349b58 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Sun, 3 Sep 2023 14:19:17 +0000 Subject: [PATCH 18/21] [UPD] README.rst --- .../README.rst | 15 ++++--- .../static/description/index.html | 40 ++++++++++--------- 2 files changed, 30 insertions(+), 25 deletions(-) diff --git a/maintenance_request_stage_transition/README.rst b/maintenance_request_stage_transition/README.rst index 3d022177b..60538541e 100644 --- a/maintenance_request_stage_transition/README.rst +++ b/maintenance_request_stage_transition/README.rst @@ -2,10 +2,13 @@ Maintenance Request Stage transition ==================================== -.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:5ab612a310033343be9b0e8e3f1454d7c497156c43216258be915c1c8349fcb1 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png :target: https://odoo-community.org/page/development-status @@ -19,11 +22,11 @@ Maintenance Request Stage transition .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png :target: https://translation.odoo-community.org/projects/maintenance-16-0/maintenance-16-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/16.0 - :alt: Try me on Runbot +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/maintenance&target_branch=16.0 + :alt: Try me on Runboat -|badge1| |badge2| |badge3| |badge4| |badge5| +|badge1| |badge2| |badge3| |badge4| |badge5| It allows to define the next stages of a stage and shows them on the header buttons. @@ -46,7 +49,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 smashing it by providing a detailed and welcomed +If you spotted it first, help us to smash it by providing a detailed and welcomed `feedback `_. Do not contact contributors directly about support or help with technical issues. diff --git a/maintenance_request_stage_transition/static/description/index.html b/maintenance_request_stage_transition/static/description/index.html index bda39f76c..383ae7b3d 100644 --- a/maintenance_request_stage_transition/static/description/index.html +++ b/maintenance_request_stage_transition/static/description/index.html @@ -1,20 +1,20 @@ - + - + Maintenance Request Stage transition