Commit 9e288c3b authored by Fabien Morin's avatar Fabien Morin

get script on model only if model_line parent is instance of TradeCondition


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@28045 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 457dedf7
...@@ -34,6 +34,7 @@ from Products.ERP5Type.XMLMatrix import XMLMatrix ...@@ -34,6 +34,7 @@ from Products.ERP5Type.XMLMatrix import XMLMatrix
from Products.ERP5.Document.Amount import Amount from Products.ERP5.Document.Amount import Amount
from Products.ERP5.Document.Predicate import Predicate from Products.ERP5.Document.Predicate import Predicate
from Products.ERP5.AggregatedAmountList import AggregatedAmountList from Products.ERP5.AggregatedAmountList import AggregatedAmountList
from Products.ERP5.Document.TradeCondition import TradeCondition
import zope.interface import zope.interface
def isMovement(document): def isMovement(document):
...@@ -89,8 +90,9 @@ class TradeModelLine(Predicate, XMLMatrix, Amount): ...@@ -89,8 +90,9 @@ class TradeModelLine(Predicate, XMLMatrix, Amount):
script_name = self.getCalculationScriptId() script_name = self.getCalculationScriptId()
if script_name is None: if script_name is None:
# if model line script is None, get the default model script # if model line script is None, get the default model script
model = self.getParentValue() if isinstance(self.getParentValue(), TradeCondition):
script_name = model.getCalculationScriptId() # if parent is a TradeCondition
script_name = self.getParentValue().getCalculationScriptId()
if script_name is None: if script_name is None:
return None return None
script = getattr(context, script_name, None) script = getattr(context, script_name, None)
......
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