Commit aa035c98 authored by Fabien Morin's avatar Fabien Morin

move copyInheritanceSubObjects method from PaySheetModel class to

PaySheetTransaction class because object are copied into the paysheet, not in
the model


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@18325 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a4cb237e
...@@ -92,7 +92,6 @@ class PaySheetModel(TradeCondition, XMLMatrix): ...@@ -92,7 +92,6 @@ class PaySheetModel(TradeCondition, XMLMatrix):
return reference_list return reference_list
def getInheritanceModelReferenceDict(self, model_reference_dict, def getInheritanceModelReferenceDict(self, model_reference_dict,
model_list, portal_type_list, reference_list): model_list, portal_type_list, reference_list):
''' '''
...@@ -112,7 +111,8 @@ class PaySheetModel(TradeCondition, XMLMatrix): ...@@ -112,7 +111,8 @@ class PaySheetModel(TradeCondition, XMLMatrix):
reference_list.append(reference) reference_list.append(reference)
unique_list.append(reference) unique_list.append(reference)
model_reference_dict[model.getRelativeUrl()]=unique_list if unique_list != []:
model_reference_dict[model.getRelativeUrl()]=unique_list
new_model_list = model.getSpecialiseValueList() new_model_list = model.getSpecialiseValueList()
model_reference_dict = self.getInheritanceModelReferenceDict(\ model_reference_dict = self.getInheritanceModelReferenceDict(\
...@@ -121,17 +121,3 @@ class PaySheetModel(TradeCondition, XMLMatrix): ...@@ -121,17 +121,3 @@ class PaySheetModel(TradeCondition, XMLMatrix):
portal_type_list=portal_type_list, portal_type_list=portal_type_list,
reference_list=reference_list,) reference_list=reference_list,)
return model_reference_dict return model_reference_dict
def copyInheritanceSubObjects(self, model_reference_dict):
'''
copy all sub objects containing in the dict into the current model
'''
key_list = model_reference_dict.keys()
for key in key_list:
id_list = model_reference_dict[key]
model = self.getPortalObject().restrictedTraverse(key)
if model is None:
LOG("copyInheritanceSubObjects,", 0, "can't find model %s" % key)
copied_data = model.manage_copyObjects(ids=id_list)
self.manage_pasteObjects(copied_data)
...@@ -491,3 +491,17 @@ class PaySheetTransaction(Invoice): ...@@ -491,3 +491,17 @@ class PaySheetTransaction(Invoice):
post_calculation_script() post_calculation_script()
return pay_sheet_line_list return pay_sheet_line_list
def copyInheritanceSubObjects(self, model_reference_dict):
'''
copy all sub objects containing in the dict into the current paysheet
'''
key_list = model_reference_dict.keys()
for key in key_list:
id_list = model_reference_dict[key]
model = self.getPortalObject().restrictedTraverse(key)
if model is None:
LOG("copyInheritanceSubObjects,", 0, "can't find model %s" % key)
copied_data = model.manage_copyObjects(ids=id_list)
self.manage_pasteObjects(copied_data)
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