Do not update planned date of production moves if it is not needed

This commit is contained in:
Cédric Krier
2024-10-23 19:34:26 +02:00
parent 8f570007f0
commit a3568f6bb0
+8 -4
View File
@@ -692,15 +692,19 @@ class Production(ShipmentAssignMixin, Workflow, ModelSQL, ModelView):
for production in productions:
dates = production._get_move_planned_date()
input_date, output_date = dates
inputs = [m for m in production.inputs
if m.state not in {'done', 'cancelled'}]
inputs = [
m for m in production.inputs
if m.state not in {'done', 'cancelled'}
and m.planned_date != input_date]
if inputs:
to_write.append(inputs)
to_write.append({
'planned_date': input_date,
})
outputs = [m for m in production.outputs
if m.state not in {'done', 'cancelled'}]
outputs = [
m for m in production.outputs
if m.state not in {'done', 'cancelled'}
and m.planned_date != output_date]
if outputs:
to_write.append(outputs)
to_write.append({