From e4b41a4d70435b8ae6b01bd68cc2df3bbea1e61b Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Wed, 6 Sep 2023 12:16:31 +0200 Subject: [PATCH] [MIG] rma_sale_mrp: Migration to 16.0 - Standard procedure. - Rename changed fields. TT44949 --- rma_sale_mrp/__manifest__.py | 3 ++- rma_sale_mrp/tests/test_rma_sale_mrp.py | 15 ++++++++------- rma_sale_mrp/wizard/sale_order_rma_wizard.py | 3 ++- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/rma_sale_mrp/__manifest__.py b/rma_sale_mrp/__manifest__.py index 3c0058fa..2854d593 100644 --- a/rma_sale_mrp/__manifest__.py +++ b/rma_sale_mrp/__manifest__.py @@ -1,9 +1,10 @@ # Copyright 2020 Tecnativa - David Vidal +# Copyright 2023 Tecnativa - Pedro M. Baeza # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). { "name": "Return Merchandise Authorization Management - Link with MRP Kits", "summary": "Allow doing RMAs from MRP kits", - "version": "15.0.1.0.1", + "version": "16.0.1.0.0", "development_status": "Beta", "category": "RMA", "website": "https://github.com/OCA/rma", diff --git a/rma_sale_mrp/tests/test_rma_sale_mrp.py b/rma_sale_mrp/tests/test_rma_sale_mrp.py index f60c028e..5eae3df9 100644 --- a/rma_sale_mrp/tests/test_rma_sale_mrp.py +++ b/rma_sale_mrp/tests/test_rma_sale_mrp.py @@ -1,5 +1,6 @@ # Copyright 2020 Tecnativa - David Vidal # Copyright 2022 Tecnativa - Víctor Martínez +# Copyright 2023 Tecnativa - Pedro M. Baeza # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). from odoo.exceptions import UserError, ValidationError from odoo.tests import Form @@ -49,7 +50,7 @@ class TestRmaSaleMrp(TestRmaSaleBase): cls.order_out_picking = cls.sale_order.picking_ids # Confirm but leave a backorder to split moves so we can test that # the wizard correctly creates the RMAs with the proper quantities - for line in cls.order_out_picking.move_lines: + for line in cls.order_out_picking.move_ids: line.quantity_done = line.product_uom_qty - 7 wiz_act = cls.order_out_picking.button_validate() wiz = Form( @@ -57,7 +58,7 @@ class TestRmaSaleMrp(TestRmaSaleBase): ).save() wiz.process() cls.backorder = cls.sale_order.picking_ids - cls.order_out_picking - for line in cls.backorder.move_lines: + for line in cls.backorder.move_ids: line.quantity_done = line.product_uom_qty cls.backorder.button_validate() @@ -78,10 +79,10 @@ class TestRmaSaleMrp(TestRmaSaleBase): ) rma_1 = rmas.filtered(lambda x: x.product_id == self.product_kit_comp_1) rma_2 = rmas.filtered(lambda x: x.product_id == self.product_kit_comp_2) - move_1 = out_pickings.mapped("move_lines").filtered( + move_1 = out_pickings.mapped("move_ids").filtered( lambda x: x.product_id == self.product_kit_comp_1 ) - move_2 = out_pickings.mapped("move_lines").filtered( + move_2 = out_pickings.mapped("move_ids").filtered( lambda x: x.product_id == self.product_kit_comp_2 ) self.assertEqual(sum(rma_1.mapped("product_uom_qty")), 8) @@ -146,8 +147,8 @@ class TestRmaSaleMrp(TestRmaSaleBase): res = wizard.create_and_open_rma() rmas = self.env["rma"].search(res["domain"]) for rma in rmas: - res = self.report_model._get_report_from_name( - "rma.report_rma" - )._render_qweb_text(rma.ids, False) + res = self.env["ir.actions.report"]._render_qweb_html( + "rma.report_rma", rma.ids + ) self.assertRegex(str(res[0]), self.product_kit_comp_1.name) self.assertRegex(str(res[0]), self.product_kit_comp_2.name) diff --git a/rma_sale_mrp/wizard/sale_order_rma_wizard.py b/rma_sale_mrp/wizard/sale_order_rma_wizard.py index 1f376abe..e50e643c 100644 --- a/rma_sale_mrp/wizard/sale_order_rma_wizard.py +++ b/rma_sale_mrp/wizard/sale_order_rma_wizard.py @@ -1,4 +1,5 @@ # Copyright 2020 Tecnativa - David Vidal +# Copyright 2023 Tecnativa - Pedro M. Baeza # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). from odoo import _, api, fields, models from odoo.exceptions import ValidationError @@ -108,7 +109,7 @@ class SaleOrderLineRmaWizard(models.TransientModel): ) res = super(SaleOrderLineRmaWizard, not_kit)._compute_move_id() for line in self.filtered(lambda x: x.phantom_bom_product and x.picking_id): - line.move_id = line.picking_id.move_lines.filtered( + line.move_id = line.picking_id.move_ids.filtered( lambda ml: ( ml.product_id == line.product_id and ml.sale_line_id == line.sale_line_id