Copy pattern of production lead time before modification

We should not modify the caller mutable structure.
This commit is contained in:
Cédric Krier
2023-07-22 18:53:50 +02:00
parent add6afeaed
commit 0dbfe051e8
2 changed files with 2 additions and 4 deletions
+1 -2
View File
@@ -305,8 +305,7 @@ class Production(ShipmentAssignMixin, Workflow, ModelSQL, ModelView):
@fields.depends('product', 'bom')
def compute_lead_time(self, pattern=None):
if pattern is None:
pattern = {}
pattern = pattern.copy() if pattern is not None else {}
if self.product:
pattern.setdefault('bom', self.bom.id if self.bom else None)
for line in self.product.production_lead_times:
+1 -2
View File
@@ -28,8 +28,7 @@ class Production(metaclass=PoolMeta):
@fields.depends('routing')
def on_change_with_planned_start_date(self, pattern=None):
if pattern is None:
pattern = {}
pattern = pattern.copy() if pattern is not None else {}
pattern.setdefault(
'routing', self.routing.id if self.routing else None)
return super(Production, self).on_change_with_planned_start_date(