Remove default planned date on supplier shipment

Closes #12966
This commit is contained in:
Maxime Richez
2024-07-13 19:31:46 +02:00
parent a65866e59b
commit b8d9b593a8
2 changed files with 19 additions and 22 deletions
+1
View File
@@ -1,3 +1,4 @@
* Remove default planned date on supplier shipment
* Add shipped state to customer shipment
Version 7.2.0 - 2024-04-29
+18 -22
View File
@@ -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)