Commit 6168e710 authored by Fabien Morin's avatar Fabien Morin

model can be None (in case no effective model exists)


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@28046 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 9e288c3b
......@@ -141,14 +141,16 @@ class PaySheetTransaction(Invoice):
model = self.getSpecialiseValue().getEffectiveModel(\
start_date=self.getStartDate(),
stop_date=self.getStopDate())
model_reference_dict = model.getInheritanceReferenceDict(
portal_type_list=portal_type_list,
property_list=property_list)
sub_object_list = []
traverse = self.getPortalObject().unrestrictedTraverse
for model_url, id_list in model_reference_dict.items():
model = traverse(model_url)
sub_object_list.extend([model._getOb(x) for x in id_list])
if model is not None:
# if there is an effective model
model_reference_dict = model.getInheritanceReferenceDict(
portal_type_list=portal_type_list,
property_list=property_list)
traverse = self.getPortalObject().unrestrictedTraverse
for model_url, id_list in model_reference_dict.items():
model = traverse(model_url)
sub_object_list.extend([model._getOb(x) for x in id_list])
return sub_object_list
security.declareProtected(Permissions.ModifyPortalContent,
......
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