Discussion:
[Erp5-dev] collectMovement
Yoshinori Okuji
2004-05-24 16:58:09 UTC
Permalink
I've commited a generic implementation of collectMovement in
SimulationTool. It should be compatible with the old version, but has
many options and the underlying implementation is a bit different.

collectMovement can make a tree of movements by classifying them based
on resources, variants, base categories, and so on. One tricky part in
collectMovement is CriterionGroup. This class is used to classify
movements based on class-specific (or object-specific) information.

For example, InvoiceLine and InvoiceCell define the method
"getGroupCriterion" which return the result of "self.getPrice()":

def getGroupCriterion(self):
return self.getPrice()

Then, collectMovement can classify movements based on the price. This
method can return anything as far as it is a pickable object. This
means that it is necessary to use a tuple instead of a list, if you
want to return a set of values, because lists are not pickable in
Python. Also, you cannot use acquired wrappers, because these are not
pickable.

The code is tested with a part of my testFusion.py test suite.

YO
--
Yoshinori Okuji, Nexedi Research Director
Nexedi: Consulting and Development of Free / Open Source Software
http://www.nexedi.com
ERP5: Free / Open Source ERP Software for small and medium companies
http://www.erp5.org
Storever: OpenBrick, WiFi infrastructure, notebooks and servers
http://www.storever.com
Loading...