Commit 7ffc24fa authored by Yoshinori Okuji's avatar Yoshinori Okuji

Override getCalculationScript to use a type-based method, so that the user...

Override getCalculationScript to use a type-based method, so that the user does not have to set a script id explicitly.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@35445 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c1e07b92
......@@ -32,26 +32,45 @@ from Products.ERP5Type import Permissions, PropertySheet
from Products.ERP5.Document.TradeModelLine import TradeModelLine
class PaymentCondition(TradeModelLine):
"""
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
# 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
)
"""
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
# 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
)
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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment