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
......@@ -55,3 +55,22 @@ class PaymentCondition(TradeModelLine):
, 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