[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
This commit is contained in:
Sylvain GARANCHER
2017-05-17 13:10:43 +02:00
committed by Nicolas Martinelli
parent f17bc70fbc
commit 57b3894ca0
+2
View File
@@ -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()