From e96a8407b04ab62df8e0e726040cdb784534a07d Mon Sep 17 00:00:00 2001 From: Fabien Morin <fabien@nexedi.com> Date: Thu, 13 Dec 2007 22:04:29 +0000 Subject: [PATCH] add a method to copy all subobjects using the model_reference_dict (wich is the result of the two previous methods) git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@18321 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5/Document/PaySheetModel.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/product/ERP5/Document/PaySheetModel.py b/product/ERP5/Document/PaySheetModel.py index 152c712f98..a861448d9e 100644 --- a/product/ERP5/Document/PaySheetModel.py +++ b/product/ERP5/Document/PaySheetModel.py @@ -122,3 +122,16 @@ class PaySheetModel(TradeCondition, XMLMatrix): 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) -- 2.30.9