From 57b3894ca0bd0bde55cb2796c674cd9e8bbdbf0b Mon Sep 17 00:00:00 2001 From: Sylvain GARANCHER Date: Thu, 4 May 2017 13:55:12 +0200 Subject: [PATCH] [IMP] stock: allow to define `from_date` The context key `from_date` can be retrived from `self.env.context, while the context key `to_date` can be defined for each procurement group. We extend the code so that `from_date` can also be defined for each procurement group. Closes #16803 opw-743013 --- addons/stock/models/procurement.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/stock/models/procurement.py b/addons/stock/models/procurement.py index 89cdde0c064..2ad0b3812ab 100644 --- a/addons/stock/models/procurement.py +++ b/addons/stock/models/procurement.py @@ -322,6 +322,8 @@ class ProcurementOrder(models.Model): substract_quantity = location_orderpoints.subtract_procurements_from_orderpoints() for group in location_data['groups']: + if group.get('from_date'): + product_context['from_date'] = group['from_date'].strftime(DEFAULT_SERVER_DATETIME_FORMAT) if group['to_date']: product_context['to_date'] = group['to_date'].strftime(DEFAULT_SERVER_DATETIME_FORMAT) product_quantity = location_data['products'].with_context(product_context)._product_available()