diff --git a/product/ERP5/Tool/TrashTool.py b/product/ERP5/Tool/TrashTool.py index d5df6bae54c91be3decd51375066b7d50993faac..624c3d598b618411a9e2f0d94fdba853388f89fd 100644 --- a/product/ERP5/Tool/TrashTool.py +++ b/product/ERP5/Tool/TrashTool.py @@ -103,7 +103,18 @@ class TrashTool(BaseTool): backup = connection.importFile(copy) try: backup.isIndexable = ConstantGetter('isIndexable', value=False) - backup_object_container._setObject(object_id, backup) + try: + # the isIndexable setting above avoids the recursion of + # manage_afterAdd on + # Products.ERP5Type.CopySupport.CopySupport.manage_afterAdd() + # but not on event subscribers, so we need to suppress_events, + # otherwise subobjects will be reindexed + backup_object_container._setObject(object_id, backup, + suppress_events=True) + except TypeError: + # BACK: On Zope 2.8. _setObject does not accept "suppress_events" + # remove when we drop support + backup_object_container._setObject(object_id, backup) except AttributeError: # XXX we can go here due to formulator because attribute field_added # doesn't not exists on parent if it is a Trash Folder and not a Form