From c54d2337c5594fbb66d6352e9e3d942e06efb6e4 Mon Sep 17 00:00:00 2001 From: DavidJForgeFlow Date: Mon, 11 Jul 2022 10:17:38 +0200 Subject: [PATCH] [15.0][FIX] rma_sale: fixup of procurement --- rma/tests/test_rma.py | 2 +- rma/wizards/rma_make_picking.py | 7 +++++-- rma_sale/models/procurement.py | 1 + 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/rma/tests/test_rma.py b/rma/tests/test_rma.py index 0a27fbf3..c4f31728 100644 --- a/rma/tests/test_rma.py +++ b/rma/tests/test_rma.py @@ -1055,7 +1055,7 @@ class TestRma(common.TransactionCase): rma_lines.write({"receipt_policy": "delivered"}) self.assertEqual(sum(rma_lines.mapped("qty_to_receive")), 0) wizard = self.rma_make_picking.with_context( - { + **{ "active_ids": rma_lines.ids, "active_model": "rma.order.line", "picking_type": "incoming", diff --git a/rma/wizards/rma_make_picking.py b/rma/wizards/rma_make_picking.py index 45924a7b..809a6802 100644 --- a/rma/wizards/rma_make_picking.py +++ b/rma/wizards/rma_make_picking.py @@ -150,8 +150,11 @@ class RmaMakePicking(models.TransientModel): product = item.line_id.product_id if float_compare(qty, 0, product.uom_id.rounding) != 1: raise ValidationError( - _("No quantity to transfer on %s shipment of product %s.") - % (_(picking_type), product.default_code or product.name) + _( + "No quantity to transfer on %(arg1)s shipment of product %(arg2)s.", + arg1=_(picking_type), + arg2=product.default_code or product.name, + ) ) # create picking procurements = [] diff --git a/rma_sale/models/procurement.py b/rma_sale/models/procurement.py index 1b3248ee..f4a21038 100644 --- a/rma_sale/models/procurement.py +++ b/rma_sale/models/procurement.py @@ -30,6 +30,7 @@ class StockRule(models.Model): ) if "rma_line_id" in values: line = values.get("rma_line_id") + line = self.env["rma.order.line"].browse([line]) if line.reference_move_id: return res if line.sale_line_id: