[FIX] sale_order_dates: commitment date for policy all at once

When the policy of the sale order is set to
`Deliver all products at once`,
the commitment date should be the maximum of the order lines lead time
rather than the minimum, as you will deliver all lines at the same time

It looks like the former behavior is applied since Odoo 7.0
d8d0b88467

It should therefore actually be applied in 7.0/8.0/9.0,
but we consider the risk too high for databases
that are used to the former behavior, and expect the old behavior.

We therefore apply this revision only in 10.0, to minimize the risks.

opw-702271
This commit is contained in:
Denis Ledoux
2016-12-23 13:07:27 +01:00
parent 1c60a631df
commit 6cb5fc33dd
+2 -1
View File
@@ -37,7 +37,8 @@ class SaleOrder(models.Model):
dt = order_datetime + timedelta(days=line.customer_lead or 0.0)
dates_list.append(dt)
if dates_list:
order.commitment_date = fields.Datetime.to_string(min(dates_list))
commit_date = min(dates_list) if order.picking_policy == 'direct' else max(dates_list)
order.commitment_date = fields.Datetime.to_string(commit_date)
def _compute_picking_ids(self):
super(SaleOrder, self)._compute_picking_ids()