From 7ac21fb5dec0b2df4a1d07e9f537e19f30e13b4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com> Date: Mon, 25 Nov 2019 06:44:06 +0100 Subject: [PATCH] core: fix Folder_cut to check relations of sub-objects We now have getRelationCountForDeletion API for this. --- .../portal_skins/erp5_core/Folder_cut.py | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_cut.py b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_cut.py index 9a2db20fbd..57833165d0 100644 --- a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_cut.py +++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_cut.py @@ -1,20 +1,6 @@ portal = context.getPortalObject() Base_translateString = portal.Base_translateString -def Object_hasRelation(obj): - # Check if there is some related objets. - result = 0 - for o in obj.getIndexableChildValueList(): - for related in obj.portal_categories.getRelatedValueList(obj): - if related.getRelativeUrl().startswith(obj.getRelativeUrl()): - continue - elif related.getRelativeUrl().startswith('portal_simulation') : - continue - else: - result = 1 - break - return result - context.portal_selections.updateSelectionCheckedUidList(selection_name,listbox_uid,uids) uids = context.portal_selections.getSelectionCheckedUidsFor(selection_name) # make sure nothing is checked after @@ -28,7 +14,7 @@ if uids != []: object_used = 0 object_list = [x.getObject() for x in context.portal_catalog(uid=uids)] - object_used = sum([Object_hasRelation(x) for x in object_list]) + object_used = sum([x.getRelationCountForDeletion() for x in object_list]) if object_used > 0: if object_used == 1: -- 2.30.9