Commit 24b091d3 authored by Aurel's avatar Aurel

do not group by payment_uid as we don't make distinction on it

remove all previous stock quantity if we define sub variation in new inventory


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@16270 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 01ed2856
...@@ -109,7 +109,6 @@ class Inventory(Delivery): ...@@ -109,7 +109,6 @@ class Inventory(Delivery):
, group_by_sub_variation = 1 , group_by_sub_variation = 1
, group_by_variation = 1 , group_by_variation = 1
, group_by_resource = 1 , group_by_resource = 1
, group_by_payment = 1
, connection_id = connection_id , connection_id = connection_id
) )
current_inventory_dict = {} current_inventory_dict = {}
...@@ -143,7 +142,7 @@ class Inventory(Delivery): ...@@ -143,7 +142,7 @@ class Inventory(Delivery):
resource_relative_url=resource_path, resource_relative_url=resource_path,
variation_text=variation_text) variation_text=variation_text)
movement_sub_variation_text = movement.getSubVariationText() movement_sub_variation_text = movement.getSubVariationText()
# Check wath is the quantity difference # Check wath is the quantity difference
if movement_sub_variation_text in inventory_by_subvariation_dict.keys(): if movement_sub_variation_text in inventory_by_subvariation_dict.keys():
total_quantity = inventory_by_subvariation_dict.pop(movement_sub_variation_text) total_quantity = inventory_by_subvariation_dict.pop(movement_sub_variation_text)
# Put remaining subvariation in a dict to know which one to removed at end # Put remaining subvariation in a dict to know which one to removed at end
...@@ -183,27 +182,26 @@ class Inventory(Delivery): ...@@ -183,27 +182,26 @@ class Inventory(Delivery):
for resource_and_variation_key in not_used_inventory_dict.keys(): for resource_and_variation_key in not_used_inventory_dict.keys():
inventory_by_subvariation_dict = not_used_inventory_dict[resource_and_variation_key] inventory_by_subvariation_dict = not_used_inventory_dict[resource_and_variation_key]
for sub_variation_text in inventory_by_subvariation_dict.keys(): for sub_variation_text in inventory_by_subvariation_dict.keys():
if sub_variation_text not in (None, ""): # XXX maybe also need to removed those one category_list = self.getCategoryList()
category_list = self.getCategoryList() quantity = inventory_by_subvariation_dict[sub_variation_text]
quantity = inventory_by_subvariation_dict[sub_variation_text] resource_path, variation_text = resource_and_variation_key
resource_path, variation_text = resource_and_variation_key kwd = {'uid':inventory_uid,
kwd = {'uid':inventory_uid, 'start_date': start_date}
'start_date': start_date} if variation_text is not None:
if variation_text is not None: variation_list = variation_text.split('\n')
variation_list = variation_text.split('\n') else:
else: variation_list = []
variation_list = [] sub_variation_list = sub_variation_text.split('\n')
sub_variation_list = sub_variation_text.split('\n') diff_quantity = - quantity
diff_quantity = - quantity temp_delivery_line = temp_constructor(self,
temp_delivery_line = temp_constructor(self, inventory_id)
inventory_id) kwd['quantity'] = diff_quantity
kwd['quantity'] = diff_quantity category_list.append('resource/%s' % resource_path)
category_list.append('resource/%s' % resource_path) category_list.extend(variation_list)
category_list.extend(variation_list) category_list.extend(sub_variation_list)
category_list.extend(sub_variation_list) kwd['category_list'] = category_list
kwd['category_list'] = category_list temp_delivery_line.edit(**kwd)
temp_delivery_line.edit(**kwd) stock_append(temp_delivery_line)
stock_append(temp_delivery_line)
# Reindex objects # Reindex objects
object_list = [self] object_list = [self]
......
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