Commit 0d2bfb49 authored by Alexandre Boeglin's avatar Alexandre Boeglin

Make sure *PathMovementGroup work when more than one source_* or destination_*

is defined.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@12916 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 27d7753e
...@@ -347,17 +347,24 @@ class PathMovementGroup(RootMovementGroup): ...@@ -347,17 +347,24 @@ class PathMovementGroup(RootMovementGroup):
""" Group movements that have the same source and the same destination.""" """ Group movements that have the same source and the same destination."""
def __init__(self, movement, **kw): def __init__(self, movement, **kw):
RootMovementGroup.__init__(self, movement=movement, **kw) RootMovementGroup.__init__(self, movement=movement, **kw)
self.source = movement.getSource() source_list = movement.getSourceList()
self.destination = movement.getDestination() destination_list = movement.getDestinationList()
source_list.sort() ; destination_list.sort()
self.source_list = source_list
self.destination_list = destination_list
self.setGroupEdit( self.setGroupEdit(
source_value=movement.getSourceValue(), source_list=source_list,
destination_value=movement.getDestinationValue(), destination_list=destination_list
) )
def test(self, movement): def test(self, movement):
return movement.getSource() == self.source and \ source_list = movement.getSourceList()
movement.getDestination() == self.destination destination_list = movement.getDestinationList()
source_list.sort() ; destination_list.sort()
return source_list == self.source_list and \
destination_list == self.destination_list
allow_class(PathMovementGroup) allow_class(PathMovementGroup)
...@@ -377,16 +384,24 @@ class SectionPathMovementGroup(RootMovementGroup): ...@@ -377,16 +384,24 @@ class SectionPathMovementGroup(RootMovementGroup):
destination_section.""" destination_section."""
def __init__(self, movement, **kw): def __init__(self, movement, **kw):
RootMovementGroup.__init__(self, movement=movement, **kw) RootMovementGroup.__init__(self, movement=movement, **kw)
self.source_section = movement.getSourceSection() source_section_list = movement.getSourceSectionList()
self.destination_section = movement.getDestinationSection() destination_section_list = movement.getDestinationSectionList()
source_section_list.sort() ; destination_section_list.sort()
self.source_section_list = source_section_list
self.destination_section_list = destination_section_list
self.setGroupEdit( self.setGroupEdit(
source_section = movement.getSourceSection(), source_section_list=source_section_list,
destination_section = movement.getDestinationSection(), destination_section_list=destination_section_list
) )
def test(self, movement): def test(self, movement):
return movement.getSourceSection() == self.source_section and \ source_section_list = movement.getSourceSectionList()
movement.getDestinationSection() == self.destination_section destination_section_list = movement.getDestinationSectionList()
source_section_list.sort() ; destination_section_list.sort()
return source_section_list == self.source_section_list and \
destination_section_list == self.destination_section_list
allow_class(SectionPathMovementGroup) allow_class(SectionPathMovementGroup)
...@@ -397,17 +412,24 @@ class TradePathMovementGroup(RootMovementGroup): ...@@ -397,17 +412,24 @@ class TradePathMovementGroup(RootMovementGroup):
""" """
def __init__(self, movement, **kw): def __init__(self, movement, **kw):
RootMovementGroup.__init__(self, movement=movement, **kw) RootMovementGroup.__init__(self, movement=movement, **kw)
self.source_trade = movement.getSourceTrade() source_trade_list = movement.getSourceTradeList()
self.destination_trade = movement.getDestinationTrade() destination_trade_list = movement.getDestinationTradeList()
source_trade_list.sort() ; destination_trade_list.sort()
self.source_trade_list = source_trade_list
self.destination_trade_list = destination_trade_list
self.setGroupEdit( self.setGroupEdit(
source_trade_value=movement.getSourceTradeValue(), source_trade_list=source_trade_list,
destination_trade_value=movement.getDestinationTradeValue(), destination_trade_list=destination_trade_list
) )
def test(self, movement): def test(self, movement):
return movement.getSourceTrade() == self.source_trade and \ source_trade_list = movement.getSourceTradeList()
movement.getDestinationTrade() == self.destination_trade destination_trade_list = movement.getDestinationTradeList()
source_trade_list.sort() ; destination_trade_list.sort()
return source_trade_list == self.source_trade_list and \
destination_trade_list == self.destination_trade_list
allow_class(TradePathMovementGroup) allow_class(TradePathMovementGroup)
......
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