From 914997563b6a3f2974db3b12942352cd7dd428fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Mart=C3=ADnez?= Date: Tue, 24 Jan 2023 17:22:19 +0100 Subject: [PATCH] [FIX] stock_request_mrp: Avoid copying the relationship to mrp.production when duplicating a record TT41342 --- stock_request_mrp/models/stock_request.py | 1 + stock_request_mrp/tests/test_stock_request_mrp.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/stock_request_mrp/models/stock_request.py b/stock_request_mrp/models/stock_request.py index 3d7e483c9..b5d871920 100644 --- a/stock_request_mrp/models/stock_request.py +++ b/stock_request_mrp/models/stock_request.py @@ -15,6 +15,7 @@ class StockRequest(models.Model): "mrp_production_id", string="Manufacturing Orders", readonly=True, + copy=False, ) production_count = fields.Integer( string="Manufacturing Orders count", diff --git a/stock_request_mrp/tests/test_stock_request_mrp.py b/stock_request_mrp/tests/test_stock_request_mrp.py index 4421eac0f..c4b8ef22e 100644 --- a/stock_request_mrp/tests/test_stock_request_mrp.py +++ b/stock_request_mrp/tests/test_stock_request_mrp.py @@ -163,6 +163,8 @@ class TestStockRequestMrp(common.TransactionCase): manufacturing_order.with_context(skip_immediate=True).button_mark_done() self.assertEqual(order.stock_request_ids.qty_in_progress, 0.0) self.assertEqual(order.stock_request_ids.qty_done, 5.0) + order2 = order.copy() + self.assertFalse(order2.production_ids) def test_view_actions(self): expected_date = fields.Datetime.now()