diff --git a/modules/stock/CHANGELOG b/modules/stock/CHANGELOG index 676e782bad..8886c1cc9b 100644 --- a/modules/stock/CHANGELOG +++ b/modules/stock/CHANGELOG @@ -1,3 +1,4 @@ +* Remove default planned date on supplier shipment * Add shipped state to customer shipment Version 7.2.0 - 2024-04-29 diff --git a/modules/stock/shipment.py b/modules/stock/shipment.py index 5ea743c4e1..31cbc11d79 100644 --- a/modules/stock/shipment.py +++ b/modules/stock/shipment.py @@ -517,10 +517,6 @@ class ShipmentIn( table, _ = tables[None] return [Coalesce(table.effective_date, table.planned_date)] - @staticmethod - def default_planned_date(): - return Pool().get('ir.date').today() - @staticmethod def default_state(): return 'draft' @@ -597,24 +593,24 @@ class ShipmentIn( for shipment in shipments: dates = shipment._move_planned_date incoming_date, inventory_date = dates - # 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 {'done', 'cancelled'} - and ((m.planned_date or datetime.date.max) - < (incoming_date or datetime.date.max)))] - if incoming_moves_to_write: - to_write.extend((incoming_moves_to_write, { - 'planned_date': incoming_date, - })) - inventory_moves_to_write = [m for m in shipment.inventory_moves - 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: - to_write.extend((inventory_moves_to_write, { - 'planned_date': inventory_date, - })) + if incoming_date: + incoming_moves_to_write = [ + m for m in shipment.incoming_moves + if (m.state not in {'done', 'cancelled'})] + if incoming_moves_to_write: + to_write.extend( + (incoming_moves_to_write, { + 'planned_date': incoming_date, + })) + if inventory_date: + inventory_moves_to_write = [ + m for m in shipment.inventory_moves + if (m.state not in {'done', 'cancelled'})] + if inventory_moves_to_write: + to_write.extend( + (inventory_moves_to_write, { + 'planned_date': inventory_date, + })) if to_write: Move.write(*to_write)