Commit 303e2844 authored by Sebastien Robin's avatar Sebastien Robin

check if there is no line with an empty resource


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4978 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 206cc576
...@@ -81,35 +81,36 @@ class Inventory(Delivery): ...@@ -81,35 +81,36 @@ class Inventory(Delivery):
node = self.getDestination() node = self.getDestination()
for movement in self.getMovementList(): for movement in self.getMovementList():
resource = movement.getResourceValue() resource = movement.getResourceValue()
variation_text = movement.getVariationText() if resource is not None:
if (resource,variation_text) not in resource_and_variation_list: variation_text = movement.getVariationText()
resource_and_variation_list.append((resource,variation_text)) if (resource,variation_text) not in resource_and_variation_list:
current_inventory_list = resource.getInventoryList( \ resource_and_variation_list.append((resource,variation_text))
to_date = start_date current_inventory_list = resource.getInventoryList( \
, variation_text = variation_text to_date = start_date
, node = node , variation_text = variation_text
, simulation_state = self.getPortalCurrentInventoryStateList() , node = node
, group_by_sub_variation = 1 , simulation_state = self.getPortalCurrentInventoryStateList()
, group_by_variation = 1 , group_by_sub_variation = 1
) , group_by_variation = 1
kwd = {'uid':self.getUid()} )
kwd['start_date'] = start_date kwd = {'uid':self.getUid()}
variation_list = variation_text.split('/n') kwd['start_date'] = start_date
for inventory in current_inventory_list: variation_list = variation_text.split('/n')
sub_variation_list = [] for inventory in current_inventory_list:
if inventory.sub_variation_text is not None: sub_variation_list = []
sub_variation_list = inventory.sub_variation_text.split('\n') if inventory.sub_variation_text is not None:
category_list = self.getCategoryList() sub_variation_list = inventory.sub_variation_text.split('\n')
if inventory.total_quantity != 0: category_list = self.getCategoryList()
temp_delivery_line = newTempDeliveryLine(self, if inventory.total_quantity != 0:
self.getId()) temp_delivery_line = newTempDeliveryLine(self,
kwd['quantity'] = - inventory.total_quantity self.getId())
category_list.append('resource/%s' % inventory.resource_relative_url) kwd['quantity'] = - inventory.total_quantity
category_list.extend(variation_list) category_list.append('resource/%s' % inventory.resource_relative_url)
category_list.extend(sub_variation_list) category_list.extend(variation_list)
kwd['category_list'] = category_list category_list.extend(sub_variation_list)
temp_delivery_line.edit(**kwd) kwd['category_list'] = category_list
stock_object_list.append(temp_delivery_line) temp_delivery_line.edit(**kwd)
stock_object_list.append(temp_delivery_line)
object_list = [self] object_list = [self]
self.portal_catalog.catalogObjectList(object_list) self.portal_catalog.catalogObjectList(object_list)
self.portal_catalog.catalogObjectList(stock_object_list, self.portal_catalog.catalogObjectList(stock_object_list,
......
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