From 6132b9c263683a86ef873b8aaf3bf227ebef8bc9 Mon Sep 17 00:00:00 2001 From: David Date: Thu, 9 Mar 2023 17:03:01 +0100 Subject: [PATCH] [FIX] rma_sale_mrp: avoid reopening of kit RMAs As we rely on the kit_qty field have the kit/component relation an that's computed when the RMA is created, we want to avoid reopening the RMA to avoid inconsitencies. The user should create a new RMA. TT41943 --- rma_sale_mrp/README.rst | 15 +++++--- rma_sale_mrp/__manifest__.py | 2 +- rma_sale_mrp/i18n/es.po | 8 ++++ rma_sale_mrp/i18n/pt.po | 8 ++++ rma_sale_mrp/i18n/pt_BR.po | 8 ++++ rma_sale_mrp/i18n/rma_sale_mrp.pot | 8 ++++ rma_sale_mrp/models/rma.py | 10 +++++ rma_sale_mrp/static/description/index.html | 44 +++++++++++----------- 8 files changed, 75 insertions(+), 28 deletions(-) diff --git a/rma_sale_mrp/README.rst b/rma_sale_mrp/README.rst index a06e04ec..f1fe14a4 100644 --- a/rma_sale_mrp/README.rst +++ b/rma_sale_mrp/README.rst @@ -2,10 +2,13 @@ Return Merchandise Authorization Management - Link with MRP Kits ================================================================ -.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:0732df3fa1f233227b79559d986200b0134d889138d9cddc481ee01c6ef1e7d8 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png :target: https://odoo-community.org/page/development-status @@ -19,11 +22,11 @@ Return Merchandise Authorization Management - Link with MRP Kits .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png :target: https://translation.odoo-community.org/projects/rma-15-0/rma-15-0-rma_sale_mrp :alt: Translate me on Weblate -.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/145/15.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/rma&target_branch=15.0 + :alt: Try me on Runboat -|badge1| |badge2| |badge3| |badge4| |badge5| +|badge1| |badge2| |badge3| |badge4| |badge5| This module enables RMAs for kits, wich isn't compatible with the base modules. In the backend side, we can return separate component while in the frontend @@ -73,7 +76,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/rma_sale_mrp/__manifest__.py b/rma_sale_mrp/__manifest__.py index bab7f708..3c0058fa 100644 --- a/rma_sale_mrp/__manifest__.py +++ b/rma_sale_mrp/__manifest__.py @@ -3,7 +3,7 @@ { "name": "Return Merchandise Authorization Management - Link with MRP Kits", "summary": "Allow doing RMAs from MRP kits", - "version": "15.0.1.0.0", + "version": "15.0.1.0.1", "development_status": "Beta", "category": "RMA", "website": "https://github.com/OCA/rma", diff --git a/rma_sale_mrp/i18n/es.po b/rma_sale_mrp/i18n/es.po index bb4f5bc8..d5e6873e 100644 --- a/rma_sale_mrp/i18n/es.po +++ b/rma_sale_mrp/i18n/es.po @@ -284,6 +284,14 @@ msgid "" "or some of the components where already put in another RMA" msgstr "" +#. module: rma_sale_mrp +#: code:addons/rma_sale_mrp/models/rma.py:0 +#, python-format +msgid "" +"To avoid kit quantities inconsistencies it is not possible to convert to " +"draft a cancelled RMA. You should do a new one from the sales order." +msgstr "" + #. module: rma_sale_mrp #: model:ir.model.fields,help:rma_sale_mrp.field_rma__kit_qty msgid "" diff --git a/rma_sale_mrp/i18n/pt.po b/rma_sale_mrp/i18n/pt.po index 2eb4f9e7..9fafa69e 100644 --- a/rma_sale_mrp/i18n/pt.po +++ b/rma_sale_mrp/i18n/pt.po @@ -278,6 +278,14 @@ msgid "" "or some of the components where already put in another RMA" msgstr "" +#. module: rma_sale_mrp +#: code:addons/rma_sale_mrp/models/rma.py:0 +#, python-format +msgid "" +"To avoid kit quantities inconsistencies it is not possible to convert to " +"draft a cancelled RMA. You should do a new one from the sales order." +msgstr "" + #. module: rma_sale_mrp #: model:ir.model.fields,help:rma_sale_mrp.field_rma__kit_qty msgid "" diff --git a/rma_sale_mrp/i18n/pt_BR.po b/rma_sale_mrp/i18n/pt_BR.po index 8f0872f1..c07a3bf8 100644 --- a/rma_sale_mrp/i18n/pt_BR.po +++ b/rma_sale_mrp/i18n/pt_BR.po @@ -283,6 +283,14 @@ msgid "" "or some of the components where already put in another RMA" msgstr "" +#. module: rma_sale_mrp +#: code:addons/rma_sale_mrp/models/rma.py:0 +#, python-format +msgid "" +"To avoid kit quantities inconsistencies it is not possible to convert to " +"draft a cancelled RMA. You should do a new one from the sales order." +msgstr "" + #. module: rma_sale_mrp #: model:ir.model.fields,help:rma_sale_mrp.field_rma__kit_qty msgid "" diff --git a/rma_sale_mrp/i18n/rma_sale_mrp.pot b/rma_sale_mrp/i18n/rma_sale_mrp.pot index b358e8aa..32e88124 100644 --- a/rma_sale_mrp/i18n/rma_sale_mrp.pot +++ b/rma_sale_mrp/i18n/rma_sale_mrp.pot @@ -269,6 +269,14 @@ msgid "" "or some of the components where already put in another RMA" msgstr "" +#. module: rma_sale_mrp +#: code:addons/rma_sale_mrp/models/rma.py:0 +#, python-format +msgid "" +"To avoid kit quantities inconsistencies it is not possible to convert to " +"draft a cancelled RMA. You should do a new one from the sales order." +msgstr "" + #. module: rma_sale_mrp #: model:ir.model.fields,help:rma_sale_mrp.field_rma__kit_qty msgid "" diff --git a/rma_sale_mrp/models/rma.py b/rma_sale_mrp/models/rma.py index 741af052..b83a8a93 100644 --- a/rma_sale_mrp/models/rma.py +++ b/rma_sale_mrp/models/rma.py @@ -65,3 +65,13 @@ class Rma(models.Model): } ) return res + + def action_draft(self): + if self.filtered(lambda r: r.state == "cancelled" and r.phantom_bom_product): + raise UserError( + _( + "To avoid kit quantities inconsistencies it is not possible to convert " + "to draft a cancelled RMA. You should do a new one from the sales order." + ) + ) + return super().action_draft() diff --git a/rma_sale_mrp/static/description/index.html b/rma_sale_mrp/static/description/index.html index 853c48aa..d087de70 100644 --- a/rma_sale_mrp/static/description/index.html +++ b/rma_sale_mrp/static/description/index.html @@ -1,20 +1,20 @@ - + - + Return Merchandise Authorization Management - Link with MRP Kits