From aa035c9892b13c7383d0c89e08fc6c686ad3ee32 Mon Sep 17 00:00:00 2001 From: Fabien Morin <fabien@nexedi.com> Date: Fri, 14 Dec 2007 09:15:01 +0000 Subject: [PATCH] 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 --- product/ERP5/Document/PaySheetModel.py | 18 ++---------------- product/ERP5/Document/PaySheetTransaction.py | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/product/ERP5/Document/PaySheetModel.py b/product/ERP5/Document/PaySheetModel.py index a861448d9e..62ceeee554 100644 --- a/product/ERP5/Document/PaySheetModel.py +++ b/product/ERP5/Document/PaySheetModel.py @@ -92,7 +92,6 @@ class PaySheetModel(TradeCondition, XMLMatrix): return reference_list - def getInheritanceModelReferenceDict(self, model_reference_dict, model_list, portal_type_list, reference_list): ''' @@ -112,7 +111,8 @@ class PaySheetModel(TradeCondition, XMLMatrix): reference_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() model_reference_dict = self.getInheritanceModelReferenceDict(\ @@ -121,17 +121,3 @@ class PaySheetModel(TradeCondition, XMLMatrix): portal_type_list=portal_type_list, reference_list=reference_list,) 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) diff --git a/product/ERP5/Document/PaySheetTransaction.py b/product/ERP5/Document/PaySheetTransaction.py index fe7123bd09..665bac80ed 100644 --- a/product/ERP5/Document/PaySheetTransaction.py +++ b/product/ERP5/Document/PaySheetTransaction.py @@ -491,3 +491,17 @@ class PaySheetTransaction(Invoice): post_calculation_script() 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) -- 2.30.9