From 8dce8c4795099c5e2cb6a832d79caf5c828291fe Mon Sep 17 00:00:00 2001
From: Sebastien Robin <seb@nexedi.com>
Date: Fri, 25 Nov 2005 15:29:24 +0000
Subject: [PATCH] again add bad movement groups

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4404 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/MovementGroup.py | 46 +++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/product/ERP5/MovementGroup.py b/product/ERP5/MovementGroup.py
index 36667de70c..e41374cd12 100755
--- a/product/ERP5/MovementGroup.py
+++ b/product/ERP5/MovementGroup.py
@@ -825,3 +825,49 @@ class DecisionMovementGroup(RootMovementGroup):
 
 allow_class(DecisionMovementGroup)
 
+# XXX This should not be here
+# I (seb) have commited this because movement groups are not
+# yet configurable through the zope web interface
+class BrandMovementGroup(RootMovementGroup):
+
+  def getBrand(self,movement):
+    return movement.getBrand()
+
+  def __init__(self,movement,**kw):
+    RootMovementGroup.__init__(self, movement=movement, **kw)
+    brand = self.getBrand(movement)
+    self.brand = brand
+    self.setGroupEdit(
+        brand=brand
+    )
+
+  def test(self,movement):
+    if self.getBrand(movement) == self.brand :
+      return 1
+    else :
+      return 0
+
+allow_class(BrandMovementGroup)
+
+class AggregateMovementGroup(RootMovementGroup):
+
+  def getAggregateList(self,movement):
+    aggregate_list = movement.getAggregateList()
+    aggregate_list.sort()
+    return aggregate_list
+
+  def __init__(self,movement,**kw):
+    RootMovementGroup.__init__(self, movement=movement, **kw)
+    aggregate = self.getAggregateList(movement)
+    self.aggregate = aggregate
+    self.setGroupEdit(
+        aggregate=aggregate
+    )
+
+  def test(self,movement):
+    if self.getAggregate(movement) == self.aggregate :
+      return 1
+    else :
+      return 0
+
+allow_class(BrandMovementGroup)
-- 
2.30.9