diff --git a/rma_sale_mrp/__manifest__.py b/rma_sale_mrp/__manifest__.py
index 2c38d08f..6bfa5b76 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": "12.0.1.0.1",
+ "version": "12.0.1.0.2",
"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 1e280efe..dcd707d6 100644
--- a/rma_sale_mrp/i18n/es.po
+++ b/rma_sale_mrp/i18n/es.po
@@ -10,32 +10,72 @@ msgstr ""
"PO-Revision-Date: 2021-01-22 14:44+0100\n"
"Last-Translator: <>\n"
"Language-Team: \n"
+"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: \n"
-"Language: es\n"
"X-Generator: Poedit 2.3\n"
#. module: rma_sale_mrp
#: model_terms:ir.ui.view,arch_db:rma_sale_mrp.portal_rma_page
-msgid " Cancelled"
-msgstr "Cancelado"
+msgid ""
+" Cancelled"
+msgstr ""
+"Cancelado"
#. module: rma_sale_mrp
#: model_terms:ir.ui.view,arch_db:rma_sale_mrp.portal_rma_page
-msgid " Draft"
-msgstr " Borrador"
+msgid ""
+" Draft"
+msgstr ""
+" Borrador"
#. module: rma_sale_mrp
#: model_terms:ir.ui.view,arch_db:rma_sale_mrp.portal_rma_page
-msgid " Waiting"
-msgstr " En espera"
+msgid ""
+" Waiting"
+msgstr ""
+" En espera"
+
+#. module: rma_sale_mrp
+#: model_terms:ir.ui.view,arch_db:rma_sale_mrp.report_rma_document
+msgid "Product"
+msgstr ""
+
+#. module: rma_sale_mrp
+#: model_terms:ir.ui.view,arch_db:rma_sale_mrp.report_rma_document
+msgid "Quantity"
+msgstr ""
+
+#. module: rma_sale_mrp
+#: model_terms:ir.ui.view,arch_db:rma_sale_mrp.report_rma_document
+msgid "RMA"
+msgstr ""
+
+#. module: rma_sale_mrp
+#: model_terms:ir.ui.view,arch_db:rma_sale_mrp.report_rma_document
+msgid "State"
+msgstr ""
#. module: rma_sale_mrp
#: model_terms:ir.ui.view,arch_db:rma_sale_mrp.portal_rma_page
+#: model_terms:ir.ui.view,arch_db:rma_sale_mrp.report_rma_document
msgid "Related Kit Components RMAs"
-msgstr "RMAs relacionados de los componentes del kit"
+msgstr ""
+"RMAs relacionados de los componentes del kit"
+"strong>"
+
+#. module: rma_sale_mrp
+#: model_terms:ir.ui.view,arch_db:rma_sale_mrp.report_rma_document
+msgid "Kit information"
+msgstr ""
#. module: rma_sale_mrp
#: model_terms:ir.ui.view,arch_db:rma_sale_mrp.portal_rma_page
@@ -47,6 +87,16 @@ msgstr " Ctd. de kits"
msgid " Kit"
msgstr " Kit"
+#. module: rma_sale_mrp
+#: model_terms:ir.ui.view,arch_db:rma_sale_mrp.report_rma_document
+msgid "Kit Quantity:"
+msgstr ""
+
+#. module: rma_sale_mrp
+#: model_terms:ir.ui.view,arch_db:rma_sale_mrp.report_rma_document
+msgid "Kit:"
+msgstr ""
+
#. module: rma_sale_mrp
#: model:ir.model.fields,field_description:rma_sale_mrp.field_sale_order_line_rma_wizard_component__allowed_picking_ids
msgid "Allowed Picking"
@@ -69,8 +119,13 @@ msgstr "Líneas de componentes"
#. module: rma_sale_mrp
#: model:ir.model.fields,help:rma_sale_mrp.field_sale_order_line_rma_wizard_component__uom_category_id
-msgid "Conversion between Units of Measure can only occur if they belong to the same category. The conversion will be made based on the ratios."
-msgstr "La conversión entre las unidades de medidas sólo pueden ocurrir si pertenecen a la misma categoría. La conversión se basará en los ratios establecidos."
+msgid ""
+"Conversion between Units of Measure can only occur if they belong to the "
+"same category. The conversion will be made based on the ratios."
+msgstr ""
+"La conversión entre las unidades de medidas sólo pueden ocurrir si "
+"pertenecen a la misma categoría. La conversión se basará en los ratios "
+"establecidos."
#. module: rma_sale_mrp
#: model:ir.model.fields,field_description:rma_sale_mrp.field_sale_order_line_rma_wizard_component__create_uid
@@ -102,6 +157,11 @@ msgstr "Nombre mostrado"
msgid "ID"
msgstr ""
+#. module: rma_sale_mrp
+#: model:ir.model,name:rma_sale_mrp.model_account_invoice
+msgid "Invoice"
+msgstr ""
+
#. module: rma_sale_mrp
#: model_terms:ir.ui.view,arch_db:rma_sale_mrp.portal_my_rmas
msgid "Kit"
@@ -216,10 +276,22 @@ msgstr "Asistente de Orden de Venta - RMA"
msgid "Sales Order Line"
msgstr "Línea de pedido de venta"
+#. module: rma_sale_mrp
+#: code:addons/rma_sale_mrp/wizard/sale_order_rma_wizard.py:55
+#, python-format
+msgid ""
+"The kit corresponding to the product %s can't be put in the RMA. Either all "
+"or some of the components where already put in another RMA"
+msgstr ""
+
#. module: rma_sale_mrp
#: model:ir.model.fields,help:rma_sale_mrp.field_rma__kit_qty
-msgid "To how many kits this components corresponds to. Used mainly for refunding the right quantity"
-msgstr "A cuántos kits corresponde este componente. Utilizado principalmente para reembolsar la cantidad correcta"
+msgid ""
+"To how many kits this components corresponds to. Used mainly for refunding "
+"the right quantity"
+msgstr ""
+"A cuántos kits corresponde este componente. Utilizado principalmente para "
+"reembolsar la cantidad correcta"
#. module: rma_sale_mrp
#: model:ir.model.fields,field_description:rma_sale_mrp.field_sale_order_line_rma_wizard_component__uom_id
@@ -235,7 +307,9 @@ msgstr "Utilizado para ocultar los componentes en los asistentes"
#: model:ir.model.fields,help:rma_sale_mrp.field_sale_order_line_rma_wizard__kit_qty_done
#: model:ir.model.fields,help:rma_sale_mrp.field_sale_order_line_rma_wizard_component__kit_qty_done
msgid "Used to inform kit qty used in the rma. Will be useful to refund"
-msgstr "Utilizado para informar la cantidad de kits utilizados en el RMA. Resultará útil al reembolsar"
+msgstr ""
+"Utilizado para informar la cantidad de kits utilizados en el RMA. Resultará "
+"útil al reembolsar"
#. module: rma_sale_mrp
#: model:ir.model.fields,field_description:rma_sale_mrp.field_sale_order_line_rma_wizard_component__wizard_id
diff --git a/rma_sale_mrp/i18n/pt.po b/rma_sale_mrp/i18n/pt.po
index d723f76b..0b0a1c92 100644
--- a/rma_sale_mrp/i18n/pt.po
+++ b/rma_sale_mrp/i18n/pt.po
@@ -1,6 +1,6 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
-# * rma_sale_mrp
+# * rma_sale_mrp
#
msgid ""
msgstr ""
@@ -18,21 +18,27 @@ msgstr ""
#. module: rma_sale_mrp
#: model_terms:ir.ui.view,arch_db:rma_sale_mrp.portal_rma_page
-msgid " Cancelled"
+msgid ""
+" Cancelled"
msgstr ""
" Cancelado"
#. module: rma_sale_mrp
#: model_terms:ir.ui.view,arch_db:rma_sale_mrp.portal_rma_page
-msgid " Draft"
+msgid ""
+" Draft"
msgstr ""
" Rascunho"
#. module: rma_sale_mrp
#: model_terms:ir.ui.view,arch_db:rma_sale_mrp.portal_rma_page
-msgid " Waiting"
+msgid ""
+" Waiting"
msgstr ""
" Em Espera"
@@ -110,7 +116,9 @@ msgstr ""
#. module: rma_sale_mrp
#: model:ir.model.fields,help:rma_sale_mrp.field_sale_order_line_rma_wizard_component__uom_category_id
-msgid "Conversion between Units of Measure can only occur if they belong to the same category. The conversion will be made based on the ratios."
+msgid ""
+"Conversion between Units of Measure can only occur if they belong to the "
+"same category. The conversion will be made based on the ratios."
msgstr ""
#. module: rma_sale_mrp
@@ -262,9 +270,19 @@ msgstr "Assistente da RMA da Encomenda de Venda"
msgid "Sales Order Line"
msgstr "Linha de Encomenda de Venda"
+#. module: rma_sale_mrp
+#: code:addons/rma_sale_mrp/wizard/sale_order_rma_wizard.py:55
+#, python-format
+msgid ""
+"The kit corresponding to the product %s can't be put in the RMA. Either all "
+"or some of the components where already put in another RMA"
+msgstr ""
+
#. module: rma_sale_mrp
#: model:ir.model.fields,help:rma_sale_mrp.field_rma__kit_qty
-msgid "To how many kits this components corresponds to. Used mainly for refunding the right quantity"
+msgid ""
+"To how many kits this components corresponds to. Used mainly for refunding "
+"the right quantity"
msgstr ""
#. module: rma_sale_mrp
diff --git a/rma_sale_mrp/i18n/pt_BR.po b/rma_sale_mrp/i18n/pt_BR.po
index fc4f1142..743a6e0b 100644
--- a/rma_sale_mrp/i18n/pt_BR.po
+++ b/rma_sale_mrp/i18n/pt_BR.po
@@ -1,6 +1,6 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
-# * rma_sale_mrp
+# * rma_sale_mrp
#
msgid ""
msgstr ""
@@ -18,21 +18,27 @@ msgstr ""
#. module: rma_sale_mrp
#: model_terms:ir.ui.view,arch_db:rma_sale_mrp.portal_rma_page
-msgid " Cancelled"
+msgid ""
+" Cancelled"
msgstr ""
" Cancelado"
#. module: rma_sale_mrp
#: model_terms:ir.ui.view,arch_db:rma_sale_mrp.portal_rma_page
-msgid " Draft"
+msgid ""
+" Draft"
msgstr ""
" Rascunho"
#. module: rma_sale_mrp
#: model_terms:ir.ui.view,arch_db:rma_sale_mrp.portal_rma_page
-msgid " Waiting"
+msgid ""
+" Waiting"
msgstr ""
" Esperando"
@@ -62,8 +68,8 @@ msgstr "Estado"
#: model_terms:ir.ui.view,arch_db:rma_sale_mrp.report_rma_document
msgid "Related Kit Components RMAs"
msgstr ""
-"RMAs de componentes de kit "
-"relacionados"
+"RMAs de componentes de kit relacionados"
+"strong>"
#. module: rma_sale_mrp
#: model_terms:ir.ui.view,arch_db:rma_sale_mrp.report_rma_document
@@ -113,7 +119,9 @@ msgstr "Linhas Componentes"
#. module: rma_sale_mrp
#: model:ir.model.fields,help:rma_sale_mrp.field_sale_order_line_rma_wizard_component__uom_category_id
-msgid "Conversion between Units of Measure can only occur if they belong to the same category. The conversion will be made based on the ratios."
+msgid ""
+"Conversion between Units of Measure can only occur if they belong to the "
+"same category. The conversion will be made based on the ratios."
msgstr ""
"Uma conversão entre unidades de medida só poderá ocorrer se pertencer à "
"mesma categoria. A conversão será feita com base nas proporções."
@@ -267,9 +275,19 @@ msgstr "Assistente do Pedido de Venda RMA"
msgid "Sales Order Line"
msgstr "Linha do Pedido de Venda"
+#. module: rma_sale_mrp
+#: code:addons/rma_sale_mrp/wizard/sale_order_rma_wizard.py:55
+#, python-format
+msgid ""
+"The kit corresponding to the product %s can't be put in the RMA. Either all "
+"or some of the components where already put in another RMA"
+msgstr ""
+
#. module: rma_sale_mrp
#: model:ir.model.fields,help:rma_sale_mrp.field_rma__kit_qty
-msgid "To how many kits this components corresponds to. Used mainly for refunding the right quantity"
+msgid ""
+"To how many kits this components corresponds to. Used mainly for refunding "
+"the right quantity"
msgstr ""
"A quantos kits este componente corresponde. Usado principalmente para "
"reembolsar a quantidade certa"
diff --git a/rma_sale_mrp/i18n/rma_sale_mrp.pot b/rma_sale_mrp/i18n/rma_sale_mrp.pot
index 13388219..bff578f5 100644
--- a/rma_sale_mrp/i18n/rma_sale_mrp.pot
+++ b/rma_sale_mrp/i18n/rma_sale_mrp.pot
@@ -253,6 +253,12 @@ msgstr ""
msgid "Sales Order Line"
msgstr ""
+#. module: rma_sale_mrp
+#: code:addons/rma_sale_mrp/wizard/sale_order_rma_wizard.py:55
+#, python-format
+msgid "The kit corresponding to the product %s can't be put in the RMA. Either all or some of the components where already put in another RMA"
+msgstr ""
+
#. module: rma_sale_mrp
#: model:ir.model.fields,help:rma_sale_mrp.field_rma__kit_qty
msgid "To how many kits this components corresponds to. Used mainly for refunding the right quantity"
diff --git a/rma_sale_mrp/tests/test_rma_sale_mrp.py b/rma_sale_mrp/tests/test_rma_sale_mrp.py
index a08772c0..b64b3c49 100644
--- a/rma_sale_mrp/tests/test_rma_sale_mrp.py
+++ b/rma_sale_mrp/tests/test_rma_sale_mrp.py
@@ -1,7 +1,7 @@
# Copyright 2020 Tecnativa - David Vidal
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo.tests import Form, SavepointCase
-from odoo.exceptions import UserError
+from odoo.exceptions import UserError, ValidationError
class TestRmaSaleMrp(SavepointCase):
@@ -153,3 +153,12 @@ class TestRmaSaleMrp(SavepointCase):
wizard_id = order.action_create_rma()["res_id"]
wizard = self.env["sale.order.rma.wizard"].browse(wizard_id)
self.assertEqual(wizard.line_ids.quantity, 1)
+ wizard.create_and_open_rma()
+ # Now we open the wizard again and try to force the RMA qty wich should
+ # be 0 at this time
+ wizard_id = order.action_create_rma()["res_id"]
+ wizard = self.env["sale.order.rma.wizard"].browse(wizard_id)
+ self.assertEqual(wizard.line_ids.quantity, 0)
+ wizard.line_ids.quantity = 1
+ with self.assertRaises(ValidationError):
+ wizard.create_and_open_rma()
diff --git a/rma_sale_mrp/wizard/sale_order_rma_wizard.py b/rma_sale_mrp/wizard/sale_order_rma_wizard.py
index d372b264..d8e89772 100644
--- a/rma_sale_mrp/wizard/sale_order_rma_wizard.py
+++ b/rma_sale_mrp/wizard/sale_order_rma_wizard.py
@@ -1,6 +1,7 @@
# Copyright 2020 Tecnativa - David Vidal
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
-from odoo import api, fields, models
+from odoo import _, api, fields, models
+from odoo.exceptions import ValidationError
class SaleOrderRmaWizard(models.TransientModel):
@@ -50,6 +51,12 @@ class SaleOrderRmaWizard(models.TransientModel):
product_kit_component_lines = kit_component_lines.filtered(
lambda x: x.product_id == product and x.quantity
)
+ if not product_kit_component_lines:
+ raise ValidationError(_(
+ "The kit corresponding to the product %s can't be "
+ "put in the RMA. Either all or some of the components "
+ "where already put in another RMA"
+ ) % line.product_id.name)
qty_to_return = (
product_kit_component_lines[0].per_kit_quantity
* line.quantity