diff --git a/product/ERP5/Document/BusinessTemplate.py b/product/ERP5/Document/BusinessTemplate.py index c32efaad33368429947f347464ff2f861c40cb3b..5ae1949989f028796e34af41bb3f698b5845490c 100644 --- a/product/ERP5/Document/BusinessTemplate.py +++ b/product/ERP5/Document/BusinessTemplate.py @@ -1323,7 +1323,10 @@ class ObjectTemplateItem(BaseTemplateItem): document_id = document.getId() self._backupObject(action, trashbin, path.split('/')[:-1], document_id) - parent.manage_delObjects([document_id]) + try: + parent.manage_delObjects([document_id]) + except BadRequest: + pass # removed manually self.afterInstall() diff --git a/product/ERP5/Tool/TrashTool.py b/product/ERP5/Tool/TrashTool.py index bfdd3cf764e591a3264fe5ccd32e9c7694fe28c9..f9ab0f04da7c093dbaada146a2c27eb5e0e8499c 100644 --- a/product/ERP5/Tool/TrashTool.py +++ b/product/ERP5/Tool/TrashTool.py @@ -84,7 +84,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 @@ -140,11 +140,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[subobject_id]