Commit acbe1915 authored by Xiaowu Zhang's avatar Xiaowu Zhang

erp5_production_planning: optimisation

parent 6efca57d
......@@ -27,15 +27,17 @@ for product in portal.portal_catalog(portal_type='Product', product_line_relativ
kd = {'portal_type':'Production Planning Cell', 'base_id':'cell'}
for production_order in production_order_list:
column = '%s' % production_order.getStartDate().Date()
related_url = production_order.getAbsoluteUrl()
for production_order_line in production_order.searchFolder(portal_type='Production Order Line', strict_resource_uid=product_uid):
k = (line, column)
if not production_planning.hasInRange(*k, **kd):
production_planning.log('Waring: Production order date %s is not in range which should not be, need to check' % start_date)
if not production_planning.hasCell(*k, **kd):
new_cell = production_planning.newCell(*k, **kd)
quantity = production_order_line.getQuantity()
new_cell.edit(
quantity = production_order_line.getQuantity(),
default_quantity = production_order_line.getQuantity(),
related_url = production_order_line.getAbsoluteUrl(),
quantity = quantity,
default_quantity = quantity,
related_url = related_url,
specialise_value = production_order_line)
production_planning.record()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment