Skip to content
Snippets Groups Projects
Commit 6cb5fc33 authored by Denis Ledoux's avatar Denis Ledoux
Browse files

[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
d8d0b884

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
parent 1c60a631
Branches
Tags
No related merge requests found
......@@ -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()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment