[Erp5-report] r12916 - /erp5/trunk/products/ERP5/MovementGroup.py

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Feb 20 16:29:30 CET 2007


Author: alex
Date: Tue Feb 20 16:29:28 2007
New Revision: 12916

URL: http://svn.erp5.org?rev=12916&view=rev
Log:
Make sure *PathMovementGroup work when more than one source_* or destination_*
is defined.

Modified:
    erp5/trunk/products/ERP5/MovementGroup.py

Modified: erp5/trunk/products/ERP5/MovementGroup.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/MovementGroup.py?rev=12916&r1=12915&r2=12916&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/MovementGroup.py (original)
+++ erp5/trunk/products/ERP5/MovementGroup.py Tue Feb 20 16:29:28 2007
@@ -347,17 +347,24 @@
   """ Group movements that have the same source and the same destination."""
   def __init__(self, movement, **kw):
     RootMovementGroup.__init__(self, movement=movement, **kw)
-    self.source = movement.getSource()
-    self.destination = movement.getDestination()
-
-    self.setGroupEdit(
-        source_value=movement.getSourceValue(),
-        destination_value=movement.getDestinationValue(),
+    source_list = movement.getSourceList()
+    destination_list = movement.getDestinationList()
+    source_list.sort() ; destination_list.sort()
+
+    self.source_list = source_list
+    self.destination_list = destination_list
+
+    self.setGroupEdit(
+        source_list=source_list,
+        destination_list=destination_list
     )
 
   def test(self, movement):
-    return movement.getSource() == self.source and \
-      movement.getDestination() == self.destination
+    source_list = movement.getSourceList()
+    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)
 
@@ -377,16 +384,24 @@
   destination_section."""
   def __init__(self, movement, **kw):
     RootMovementGroup.__init__(self, movement=movement, **kw)
-    self.source_section = movement.getSourceSection()
-    self.destination_section = movement.getDestinationSection()
-    self.setGroupEdit(
-        source_section = movement.getSourceSection(),
-        destination_section = movement.getDestinationSection(),
+    source_section_list = movement.getSourceSectionList()
+    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(
+        source_section_list=source_section_list,
+        destination_section_list=destination_section_list
     )
 
   def test(self, movement):
-    return movement.getSourceSection() == self.source_section and \
-       movement.getDestinationSection() == self.destination_section
+    source_section_list = movement.getSourceSectionList()
+    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)
 
@@ -397,17 +412,24 @@
   """
   def __init__(self, movement, **kw):
     RootMovementGroup.__init__(self, movement=movement, **kw)
-    self.source_trade = movement.getSourceTrade()
-    self.destination_trade = movement.getDestinationTrade()
-
-    self.setGroupEdit(
-        source_trade_value=movement.getSourceTradeValue(),
-        destination_trade_value=movement.getDestinationTradeValue(),
+    source_trade_list = movement.getSourceTradeList()
+    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(
+        source_trade_list=source_trade_list,
+        destination_trade_list=destination_trade_list
     )
 
   def test(self, movement):
-    return movement.getSourceTrade() == self.source_trade and \
-      movement.getDestinationTrade() == self.destination_trade
+    source_trade_list = movement.getSourceTradeList()
+    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)
 




More information about the Erp5-report mailing list