diff --git a/product/ERP5/Document/BusinessTemplate.py b/product/ERP5/Document/BusinessTemplate.py index 73bea76c674c733ab712e130a55f5cb3ecefdc57..5fb222b12f975c064d4314e9ee0608d0eecaa550 100644 --- a/product/ERP5/Document/BusinessTemplate.py +++ b/product/ERP5/Document/BusinessTemplate.py @@ -1240,7 +1240,10 @@ class ObjectTemplateItem(BaseTemplateItem): container_path_list = recursive_path.split('/')[:-1] self._backupObject(action, trashbin, container_path_list, document_id) - parent.manage_delObjects([document_id]) + try: + parent.manage_delObjects([document_id]) + except BadRequest: + pass # subobject removed manually else: # for old business template format BaseTemplateItem.install(self, context, trashbin, **kw) diff --git a/product/ERP5/Tool/TrashTool.py b/product/ERP5/Tool/TrashTool.py index 31a1234064d4bdc3f46558f214c0d7cb2338d57a..d2f3a042f435bd0314b3fac6a70cdb4170239c31 100644 --- a/product/ERP5/Tool/TrashTool.py +++ b/product/ERP5/Tool/TrashTool.py @@ -82,7 +82,7 @@ class TrashTool(BaseTool): if object_id not in backup_object_container.objectIds(): # export object object_path = container_path + [object_id] - obj = self.unrestrictedTraverse(object_path) + obj = self.unrestrictedTraverse(object_path, None) if obj is not None: connection = obj._p_jar o = obj @@ -138,11 +138,10 @@ class TrashTool(BaseTool): if not keep_sub: # export subobjects if save: - obj = backup_object_container._getOb(object_id) - object_path = list(obj.getPhysicalPath()) + obj = backup_object_container._getOb(object_id, None) else: object_path = container_path + [object_id] - obj = self.unrestrictedTraverse(object_path) + obj = self.unrestrictedTraverse(object_path, None) if obj is not None: for subobject_id in list(obj.objectIds()): subobject = obj.unrestrictedTraverse(subobject_id)