From ba1d55623482fccaa9b8a62d9c3f89ddee7b4b98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 6 Feb 2024 00:12:55 +0100 Subject: [PATCH] Keep copying readonly moves of shipments Since cf8f1399bc1b readonly fields are not more copied but on shipment the moves is readonly only to force the usage of Function fields. So we could convert the readonly attribute by a static readonly states. Closes #13004 --- modules/stock/shipment.py | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/modules/stock/shipment.py b/modules/stock/shipment.py index 3f02eca0cc..400f00b160 100644 --- a/modules/stock/shipment.py +++ b/modules/stock/shipment.py @@ -407,8 +407,12 @@ class ShipmentIn( }, help="The moves that put the stock away into the storage area."), 'get_inventory_moves', setter='set_inventory_moves') - moves = fields.One2Many('stock.move', 'shipment', 'Moves', - domain=[('company', '=', Eval('company'))], readonly=True) + moves = fields.One2Many( + 'stock.move', 'shipment', "Moves", + domain=[('company', '=', Eval('company'))], + states={ + 'readonly': True, + }) origins = fields.Function(fields.Char('Origins'), 'get_origins') received_by = employee_field("Received By") done_by = employee_field("Done By") @@ -1245,8 +1249,12 @@ class ShipmentOut( }, help="The moves that pick the stock from the storage area."), 'get_inventory_moves', setter='set_inventory_moves') - moves = fields.One2Many('stock.move', 'shipment', 'Moves', - domain=[('company', '=', Eval('company'))], readonly=True) + moves = fields.One2Many( + 'stock.move', 'shipment', "Moves", + domain=[('company', '=', Eval('company'))], + states={ + 'readonly': True, + }) origins = fields.Function(fields.Char('Origins'), 'get_origins') picked_by = employee_field("Picked By") packed_by = employee_field("Packed By") @@ -1943,8 +1951,12 @@ class ShipmentOutReturn( }, help="The moves that put the stock away into the storage area."), 'get_inventory_moves', setter='set_inventory_moves') - moves = fields.One2Many('stock.move', 'shipment', 'Moves', - domain=[('company', '=', Eval('company'))], readonly=True) + moves = fields.One2Many( + 'stock.move', 'shipment', "Moves", + domain=[('company', '=', Eval('company'))], + states={ + 'readonly': True, + }) origins = fields.Function(fields.Char('Origins'), 'get_origins') received_by = employee_field("Received By") done_by = employee_field("Done By")