[Erp5-report] r35473 yusei - /erp5/trunk/products/ERP5/Document/
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu May 20 12:50:28 CEST 2010
Author: yusei
Date: Thu May 20 12:50:27 2010
New Revision: 35473
URL: http://svn.erp5.org?rev=35473&view=rev
Log:
Move the movement matching condition block to a new method and make
the condition changable. This fixes a bug tested on
test_tradeModelLineWithEmptyBaseContributionMovement.
Override the condition in PaymentCondition and make PaymentCondition
appliable to any movements.
Modified:
erp5/trunk/products/ERP5/Document/PaymentCondition.py
erp5/trunk/products/ERP5/Document/TradeModelLine.py
Modified: erp5/trunk/products/ERP5/Document/PaymentCondition.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/PaymentCondition.py?rev=35473&r1=35472&r2=35473&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/PaymentCondition.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/PaymentCondition.py [utf8] Thu May 20 12:50:27 2010
@@ -74,3 +74,8 @@
method = self._getTypeBasedMethod('calculateMovement')
return method
+ def _isMatchedMovement(self, movement, base_application_list, tmp_movement):
+ """Override the original implementation and allow payment condition to
+ match to any movements
+ """
+ return True
Modified: erp5/trunk/products/ERP5/Document/TradeModelLine.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/TradeModelLine.py?rev=35473&r1=35472&r2=35473&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/TradeModelLine.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/TradeModelLine.py [utf8] Thu May 20 12:50:27 2010
@@ -314,14 +314,7 @@
# movements (current_aggregated_amount_list).
# if the quantity is not defined, take it by searching all movements
# that used this base_amount
- if (len(base_application_list) == 0 or \
- len(movement.getBaseContributionList()) == 0 or \
- set(base_application_list).intersection( \
- set(movement.getBaseContributionList()))) and \
- (len(movement.getVariationCategoryList()) == 0 or \
- len(tmp_movement.getVariationCategoryList()) == 0 or \
- set(movement.getVariationCategoryList()).intersection( \
- set(tmp_movement.getVariationCategoryList()))):
+ if self._isMatchedMovement(movement, base_application_list, tmp_movement):
# at least one base application is in base contributions and
# if the movement have no variation category, it's the same as
# if he have all variation categories
@@ -406,3 +399,15 @@
aggregated_amount_list.append(tmp_movement)
return aggregated_amount_list
+
+
+ def _isMatchedMovement(self, movement, base_application_list, tmp_movement):
+ return (
+ set(base_application_list).intersection(
+ set(movement.getBaseContributionList())) and
+ (len(movement.getVariationCategoryList()) == 0 or
+ len(tmp_movement.getVariationCategoryList()) == 0 or
+ set(movement.getVariationCategoryList()).intersection(
+ set(tmp_movement.getVariationCategoryList()))
+ )
+ )
More information about the Erp5-report
mailing list