[Erp5-report] r35445 yo - /erp5/trunk/products/ERP5/Document/PaymentCondition.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Wed May 19 09:38:32 CEST 2010
Author: yo
Date: Wed May 19 09:38:31 2010
New Revision: 35445
URL: http://svn.erp5.org?rev=35445&view=rev
Log:
Override getCalculationScript to use a type-based method, so that the user does not have to set a script id explicitly.
Modified:
erp5/trunk/products/ERP5/Document/PaymentCondition.py
Modified: erp5/trunk/products/ERP5/Document/PaymentCondition.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/PaymentCondition.py?rev=35445&r1=35444&r2=35445&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/PaymentCondition.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/PaymentCondition.py [utf8] Wed May 19 09:38:31 2010
@@ -32,26 +32,45 @@
from Products.ERP5.Document.TradeModelLine import TradeModelLine
class PaymentCondition(TradeModelLine):
- """
- Payment Conditions are used to define all the parameters of a payment
- """
+ """
+ Payment Conditions are used to define all the parameters of a payment
+ """
- meta_type = 'ERP5 Payment Condition'
- portal_type = 'Payment Condition'
- add_permission = Permissions.AddPortalContent
+ meta_type = 'ERP5 Payment Condition'
+ portal_type = 'Payment Condition'
+ add_permission = Permissions.AddPortalContent
- # Declarative security
- security = ClassSecurityInfo()
- security.declareObjectProtected(Permissions.AccessContentsInformation)
+ # Declarative security
+ security = ClassSecurityInfo()
+ security.declareObjectProtected(Permissions.AccessContentsInformation)
- # Declarative properties
- property_sheets = ( PropertySheet.Base
- , PropertySheet.XMLObject
- , PropertySheet.CategoryCore
- , PropertySheet.DublinCore
- , PropertySheet.Amount
- , PropertySheet.PaymentCondition
- , PropertySheet.Chain
- , PropertySheet.SortIndex
- , PropertySheet.TradeModelLine
- )
+ # Declarative properties
+ property_sheets = ( PropertySheet.Base
+ , PropertySheet.XMLObject
+ , PropertySheet.CategoryCore
+ , PropertySheet.DublinCore
+ , PropertySheet.Amount
+ , PropertySheet.PaymentCondition
+ , PropertySheet.Chain
+ , PropertySheet.SortIndex
+ , PropertySheet.TradeModelLine
+ )
+
+ security.declareProtected(Permissions.AccessContentsInformation,
+ 'getCalculationScript')
+ def getCalculationScript(self, context):
+ # In the case of Payment Condition, unlike Trade Model Line,
+ # it is not realistic to share the same method, so do not acquire
+ # a script from its parent.
+ #
+ # It is always complicated and different how to adopt the calculation of
+ # payment dates for each user, and it is not practical to force the
+ # user to set a script id in every Payment Condition, so it is better
+ # to use a type-based method here, unless a script is explicitly set.
+ script_id = self.getCalculationScriptId()
+ if script_id is not None:
+ method = getattr(context, script_id)
+ return method
+ method = self._getTypeBasedMethod('calculateMovement')
+ return method
+
More information about the Erp5-report
mailing list