[Erp5-report] r27449 - /erp5/trunk/products/ERP5/Document/TradeCondition.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Mon Jun 8 18:42:51 CEST 2009
Author: luke
Date: Mon Jun 8 18:42:51 2009
New Revision: 27449
URL: http://svn.erp5.org?rev=27449&view=rev
Log:
- implement sorting in a way, that something what applies is put *before* it possible contribution
Modified:
erp5/trunk/products/ERP5/Document/TradeCondition.py
Modified: erp5/trunk/products/ERP5/Document/TradeCondition.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/TradeCondition.py?rev=27449&r1=27448&r2=27449&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/TradeCondition.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/TradeCondition.py [utf8] Mon Jun 8 18:42:51 2009
@@ -148,7 +148,8 @@
Reference of Trade Model Line is used to hide other Trade Model Line
In chain first found Trade Model Line has precedence
Context's, if not None, Trade Model Lines have precedence
- XXX - the sorting is missing
+ Result is sorted in safe order to do one time pass - movements which
+ applies are before its possible contributions.
"""
if portal_type_list is None:
portal_type_list = self.model_line_portal_type_list
@@ -173,7 +174,9 @@
trade_model_line_composed_list.append(trade_model_line)
reference_list.append(reference)
- return trade_model_line_composed_list
+ return sorted(trade_model_line_composed_list,
+ cmp=lambda x,y: set(x.getBaseContributionList()).
+ intersection(set(y.getBaseApplicationList())) and -1 or 1)
def getAggregatedAmountList(self, context, movement_list=None, **kw):
result = AggregatedAmountList()
More information about the Erp5-report
mailing list