From 6cb5fc33dd92b686711cb53f7e0791824067b409 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Fri, 23 Dec 2016 12:54:31 +0100 Subject: [PATCH] [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 d8d0b8846749b5f34f9e29463fd1e1d6e151b91b 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 --- addons/sale_order_dates/models/sale_order.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/sale_order_dates/models/sale_order.py b/addons/sale_order_dates/models/sale_order.py index e2ea8b893bb..30d602cadf8 100644 --- a/addons/sale_order_dates/models/sale_order.py +++ b/addons/sale_order_dates/models/sale_order.py @@ -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()