Update planned date of assigned move from shipment and production
Closes #12867
This commit is contained in:
1 parent
435e3a0c59
commit
aa20b2de71
2 files changed
+12
-12
No files matched your search
@@ -682,14 +682,14 @@ class Production(ShipmentAssignMixin, Workflow, ModelSQL, ModelView):
|
||||
dates = production._get_move_planned_date()
|
||||
input_date, output_date = dates
|
||||
inputs = [m for m in production.inputs
|
||||
if m.state not in ('assigned', 'done', 'cancelled')]
|
||||
if m.state not in {'done', 'cancelled'}]
|
||||
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 ('assigned', 'done', 'cancelled')]
|
||||
if m.state not in {'done', 'cancelled'}]
|
||||
if outputs:
|
||||
to_write.append(outputs)
|
||||
to_write.append({
|
||||
|
||||
+10
-10
@@ -570,7 +570,7 @@ class ShipmentIn(
|
||||
# Update planned_date only for later to not be too optimistic if
|
||||
# the shipment is not directly received.
|
||||
incoming_moves_to_write = [m for m in shipment.incoming_moves
|
||||
if (m.state not in ('assigned', 'done', 'cancelled')
|
||||
if (m.state not in {'done', 'cancelled'}
|
||||
and ((m.planned_date or datetime.date.max)
|
||||
< (incoming_date or datetime.date.max)))]
|
||||
if incoming_moves_to_write:
|
||||
@@ -578,7 +578,7 @@ class ShipmentIn(
|
||||
'planned_date': incoming_date,
|
||||
}))
|
||||
inventory_moves_to_write = [m for m in shipment.inventory_moves
|
||||
if (m.state not in ('assigned', 'done', 'cancelled')
|
||||
if (m.state not in {'done', 'cancelled'}
|
||||
and ((m.planned_date or datetime.date.max)
|
||||
< (inventory_date or datetime.date.max)))]
|
||||
if inventory_moves_to_write:
|
||||
@@ -932,7 +932,7 @@ class ShipmentInReturn(ShipmentAssignMixin, Workflow, ModelSQL, ModelView):
|
||||
to_write = []
|
||||
for shipment in shipments:
|
||||
moves = [m for m in shipment.moves
|
||||
if (m.state not in ('assigned', 'done', 'cancelled')
|
||||
if (m.state not in {'done', 'cancelled'}
|
||||
and m.planned_date != shipment._move_planned_date)]
|
||||
if moves:
|
||||
to_write.extend((moves, {
|
||||
@@ -1703,7 +1703,7 @@ class ShipmentOut(
|
||||
for shipment in shipments:
|
||||
outgoing_date, inventory_date = shipment._move_planned_date
|
||||
out_moves_to_write = [x for x in shipment.outgoing_moves
|
||||
if (x.state not in ('assigned', 'done', 'cancelled')
|
||||
if (x.state not in {'done', 'cancelled'}
|
||||
and x.planned_date != outgoing_date)]
|
||||
if out_moves_to_write:
|
||||
to_write.extend((out_moves_to_write, {
|
||||
@@ -1711,7 +1711,7 @@ class ShipmentOut(
|
||||
}))
|
||||
|
||||
inv_moves_to_write = [x for x in shipment.inventory_moves
|
||||
if (x.state not in ('assigned', 'done', 'cancelled')
|
||||
if (x.state not in {'done', 'cancelled'}
|
||||
and x.planned_date != inventory_date)]
|
||||
if inv_moves_to_write:
|
||||
to_write.extend((inv_moves_to_write, {
|
||||
@@ -2088,14 +2088,14 @@ class ShipmentOutReturn(
|
||||
dates = shipment._get_move_planned_date()
|
||||
incoming_date, inventory_date = dates
|
||||
incoming_moves_to_write = [x for x in shipment.incoming_moves
|
||||
if (x.state not in ('assigned', 'done', 'cancelled')
|
||||
if (x.state not in {'done', 'cancelled'}
|
||||
and x.planned_date != incoming_date)]
|
||||
if incoming_moves_to_write:
|
||||
to_write.extend((incoming_moves_to_write, {
|
||||
'planned_date': incoming_date,
|
||||
}))
|
||||
inventory_moves_to_write = [x for x in shipment.inventory_moves
|
||||
if (x.state not in ('assigned', 'done', 'cancelled')
|
||||
if (x.state not in {'done', 'cancelled'}
|
||||
and x.planned_date != inventory_date)]
|
||||
if inventory_moves_to_write:
|
||||
to_write.extend((inventory_moves_to_write, {
|
||||
@@ -2924,7 +2924,7 @@ class ShipmentInternal(
|
||||
and shipment.state not in {'request', 'draft'}):
|
||||
outgoing_date, incoming_date = dates
|
||||
outgoing_moves = [m for m in shipment.outgoing_moves
|
||||
if (m.state not in ('assigned', 'done', 'cancelled')
|
||||
if (m.state not in {'done', 'cancelled'}
|
||||
and m.planned_date != outgoing_date)]
|
||||
if outgoing_moves:
|
||||
to_write.append(outgoing_moves)
|
||||
@@ -2932,7 +2932,7 @@ class ShipmentInternal(
|
||||
'planned_date': outgoing_date,
|
||||
})
|
||||
incoming_moves = [m for m in shipment.incoming_moves
|
||||
if (m.state not in ('assigned', 'done', 'cancelled')
|
||||
if (m.state not in {'done', 'cancelled'}
|
||||
and m.planned_date != incoming_date)]
|
||||
if incoming_moves:
|
||||
to_write.append(incoming_moves)
|
||||
@@ -2942,7 +2942,7 @@ class ShipmentInternal(
|
||||
else:
|
||||
planned_start_date = shipment.planned_start_date
|
||||
moves = [m for m in shipment.moves
|
||||
if (m.state not in {'assigned', 'done', 'cancelled'}
|
||||
if (m.state not in {'done', 'cancelled'}
|
||||
and m.planned_date != planned_start_date)]
|
||||
if moves:
|
||||
to_write.append(moves)
|
||||
|
||||
Reference in new issue
Block a user