From a8811cec44044a7ecb82c8995915f25022733b6e Mon Sep 17 00:00:00 2001 From: bosd Date: Thu, 2 Jan 2025 13:07:43 +0100 Subject: [PATCH 1/2] [FIX] mrp_lot_number_propagation Keyerror stock.production.lot --- mrp_lot_number_propagation/models/mrp_production.py | 4 ++-- mrp_lot_number_propagation/tests/common.py | 2 +- mrp_lot_number_propagation/tests/test_mrp_production.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mrp_lot_number_propagation/models/mrp_production.py b/mrp_lot_number_propagation/models/mrp_production.py index 8d8b090d4..23c27fac3 100644 --- a/mrp_lot_number_propagation/models/mrp_production.py +++ b/mrp_lot_number_propagation/models/mrp_production.py @@ -111,7 +111,7 @@ class MrpProduction(models.Model): and m.state not in ("done", "cancel") ) if finish_moves and not finish_moves.quantity_done: - lot_model = self.env["stock.production.lot"] + lot_model = self.env["stock.lot"] lot = lot_model.search( [ ("product_id", "=", order.product_id.id), @@ -128,7 +128,7 @@ class MrpProduction(models.Model): ) ) if not lot: - lot = self.env["stock.production.lot"].create( + lot = self.env["stock.lot"].create( { "product_id": order.product_id.id, "company_id": order.company_id.id, diff --git a/mrp_lot_number_propagation/tests/common.py b/mrp_lot_number_propagation/tests/common.py index 19194492e..636194c78 100644 --- a/mrp_lot_number_propagation/tests/common.py +++ b/mrp_lot_number_propagation/tests/common.py @@ -81,7 +81,7 @@ class Common(common.TransactionCase): "company_id": line.company_id.id, "name": lot_name, } - lot = cls.env["stock.production.lot"].create(vals) + lot = cls.env["stock.lot"].create(vals) cls._update_qty_in_location( location, line.product_id, diff --git a/mrp_lot_number_propagation/tests/test_mrp_production.py b/mrp_lot_number_propagation/tests/test_mrp_production.py index b464e9a44..0ef629e5b 100644 --- a/mrp_lot_number_propagation/tests/test_mrp_production.py +++ b/mrp_lot_number_propagation/tests/test_mrp_production.py @@ -64,7 +64,7 @@ class TestMrpProduction(Common): self.assertEqual(self.order.propagated_lot_producing, self.LOT_NAME) # Create a lot with the same number for the finished product # without any stock/quants (so not used at all) before validating the MO - existing_lot = self.env["stock.production.lot"].create( + existing_lot = self.env["stock.lot"].create( { "product_id": self.order.product_id.id, "company_id": self.order.company_id.id, @@ -82,7 +82,7 @@ class TestMrpProduction(Common): # Create a lot with the same number for the finished product # with some stock/quants (so it is considered as used) before # validating the MO - existing_lot = self.env["stock.production.lot"].create( + existing_lot = self.env["stock.lot"].create( { "product_id": self.order.product_id.id, "company_id": self.order.company_id.id, From 0762c0a9ea9cbedc25b072d8a034caae83573348 Mon Sep 17 00:00:00 2001 From: bosd Date: Sat, 4 Jan 2025 01:47:58 +0100 Subject: [PATCH 2/2] [FIX] mrp_lot_number_propagation: tests import test_mrp_production stock.move.line : product_uom_qty -> reserved_uom_qty --- mrp_lot_number_propagation/tests/__init__.py | 1 + mrp_lot_number_propagation/tests/test_mrp_production.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/mrp_lot_number_propagation/tests/__init__.py b/mrp_lot_number_propagation/tests/__init__.py index a16beef0b..6f95782dc 100644 --- a/mrp_lot_number_propagation/tests/__init__.py +++ b/mrp_lot_number_propagation/tests/__init__.py @@ -1 +1,2 @@ from . import test_mrp_bom +from . import test_mrp_production diff --git a/mrp_lot_number_propagation/tests/test_mrp_production.py b/mrp_lot_number_propagation/tests/test_mrp_production.py index 0ef629e5b..9badf7f27 100644 --- a/mrp_lot_number_propagation/tests/test_mrp_production.py +++ b/mrp_lot_number_propagation/tests/test_mrp_production.py @@ -34,7 +34,7 @@ class TestMrpProduction(Common): def _set_qty_done(self, order): for line in order.move_raw_ids.move_line_ids: - line.qty_done = line.product_uom_qty + line.qty_done = line.reserved_uom_qty order.qty_producing = order.product_qty def test_order_propagated_lot_producing(self):