Commit 32ab7872 authored by Jérome Perrin's avatar Jérome Perrin

revert last change which breaks the build for invoice transaction rule.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3745 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 85b97ee1
...@@ -76,15 +76,9 @@ class RootMovementGroup: ...@@ -76,15 +76,9 @@ class RootMovementGroup:
is_movement_in_group = 0 is_movement_in_group = 0
for group in self.getGroupList(): for group in self.getGroupList():
if group.test(movement) : if group.test(movement) :
try: group.append(movement)
group.append(movement) is_movement_in_group = 1
is_movement_in_group = 1 break
break
except "MovementRejected":
if self.__class__.__name__ == self._last_line_class_name:
pass
else:
raise "MovementRejected"
if is_movement_in_group == 0 : if is_movement_in_group == 0 :
if self._nested_class is not None: if self._nested_class is not None:
self._appendGroup(movement) self._appendGroup(movement)
...@@ -96,10 +90,7 @@ class RootMovementGroup: ...@@ -96,10 +90,7 @@ class RootMovementGroup:
# 2 movements on the same node group # 2 movements on the same node group
tmp_result = self._separate(movement) tmp_result = self._separate(movement)
self._movement_list, split_movement_list = tmp_result self._movement_list, split_movement_list = tmp_result
if split_movement_list != []: # XXX Do something with split_movement_list !
# We rejected a movement, we need to put it on another line
# Or to create a new one
raise "MovementRejected"
else: else:
# No movement on this node, we can add it # No movement on this node, we can add it
self._movement_list.append(movement) self._movement_list.append(movement)
...@@ -154,11 +145,8 @@ class RootMovementGroup: ...@@ -154,11 +145,8 @@ class RootMovementGroup:
new_stored_movement,\ new_stored_movement,\
rejected_movement= method(new_stored_movement, rejected_movement= method(new_stored_movement,
added_movement=added_movement) added_movement=added_movement)
if rejected_movement is None: added_movement = None
added_movement = None
else:
break
return [new_stored_movement], [rejected_movement] return [new_stored_movement], [rejected_movement]
...@@ -185,12 +173,6 @@ class RootMovementGroup: ...@@ -185,12 +173,6 @@ class RootMovementGroup:
new_movement.setPriceMethod("getAveragePrice") new_movement.setPriceMethod("getAveragePrice")
return new_movement, None return new_movement, None
def calculateSeparatePrice(self, movement, added_movement=None):
"""
Separate movement which have the same price
"""
return movement, added_movement
def calculateAddQuantity(self, movement, added_movement=None): def calculateAddQuantity(self, movement, added_movement=None):
""" """
Create a new movement with the sum of quantity Create a new movement with the sum of quantity
...@@ -463,36 +445,6 @@ class CategoryMovementGroup(RootMovementGroup): ...@@ -463,36 +445,6 @@ class CategoryMovementGroup(RootMovementGroup):
allow_class(CategoryMovementGroup) allow_class(CategoryMovementGroup)
class OptionMovementGroup(RootMovementGroup):
def __init__(self,movement,**kw):
RootMovementGroup.__init__(self, movement=movement, **kw)
option_base_category_list = movement.getPortalOptionBaseCategoryList()
self.option_category_list = movement.getVariationCategoryList(base_category_list=option_base_category_list)
#LOG('OptionMovementGroup.__init__, option_category_list',0,self.option_category_list)
if self.option_category_list is None:
self.option_category_list = []
# XXX This is very bad, but no choice today.
self.setGroupEdit(industrial_phase_list = self.option_category_list)
def test(self,movement):
# we must have the same number of categories
categories_identity = 0
option_base_category_list = movement.getPortalOptionBaseCategoryList()
movement_option_category_list = movement.getVariationCategoryList(base_category_list=option_base_category_list)
#LOG('OptionMovementGroup.test, option_category_list',0,movement_option_category_list)
if movement_option_category_list is None:
movement_option_category_list = []
if len(self.option_category_list) == len(movement_option_category_list):
categories_identity = 1
for category in movement_option_category_list:
if not category in self.option_category_list :
categories_identity = 0
break
return categories_identity
allow_class(OptionMovementGroup)
class FakeMovement: class FakeMovement:
""" """
A fake movement which simulate some methods on a movement needed A fake movement which simulate some methods on a movement needed
...@@ -699,3 +651,34 @@ class FakeMovement: ...@@ -699,3 +651,34 @@ class FakeMovement:
else: else:
raise "FakeMovementError",\ raise "FakeMovementError",\
"Could not call edit on Fakeovement with parameters: %r" % key "Could not call edit on Fakeovement with parameters: %r" % key
class OptionMovementGroup(RootMovementGroup):
def __init__(self,movement,**kw):
RootMovementGroup.__init__(self, movement=movement, **kw)
option_base_category_list = movement.getPortalOptionBaseCategoryList()
self.option_category_list = movement.getVariationCategoryList(base_category_list=option_base_category_list)
#LOG('OptionMovementGroup.__init__, option_category_list',0,self.option_category_list)
if self.option_category_list is None:
self.option_category_list = []
# XXX This is very bad, but no choice today.
self.setGroupEdit(industrial_phase_list = self.option_category_list)
def test(self,movement):
# we must have the same number of categories
categories_identity = 0
option_base_category_list = movement.getPortalOptionBaseCategoryList()
movement_option_category_list = movement.getVariationCategoryList(base_category_list=option_base_category_list)
#LOG('OptionMovementGroup.test, option_category_list',0,movement_option_category_list)
if movement_option_category_list is None:
movement_option_category_list = []
if len(self.option_category_list) == len(movement_option_category_list):
categories_identity = 1
for category in movement_option_category_list:
if not category in self.option_category_list :
categories_identity = 0
break
return categories_identity
allow_class(OptionMovementGroup)
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