diff --git a/product/ERP5/Document/BusinessTemplate.py b/product/ERP5/Document/BusinessTemplate.py index 314e09fa54d1ff28f5cbaf40ae80cc578ed7e93a..0c5480a7b98f63862d5aaaf0b8ccf8df6f48b5fa 100644 --- a/product/ERP5/Document/BusinessTemplate.py +++ b/product/ERP5/Document/BusinessTemplate.py @@ -904,7 +904,15 @@ class ObjectTemplateItem(BaseTemplateItem): # mark a business template installation so in 'PortalType_afterClone' scripts # we can implement logical for reseting or not attributes (i.e reference). self.REQUEST.set('is_business_template_installation', 1) + # We set isIndexable to 0 before calling + # manage_afterClone in order to not call recursiveReindex, this is + # useless because we will already reindex every created object, so + # we avoid duplication of reindexation + obj.isIndexable = 0 obj.manage_afterClone(obj) + del obj.isIndexable + if getattr(aq_base(obj), 'reindexObject', None) is not None: + obj.reindexObject() obj.wl_clearLocks() if portal_type_dict: # set workflow chain diff --git a/product/ERP5/ERP5Site.py b/product/ERP5/ERP5Site.py index e60076d322dd2a0d7e24c8a177e6d617eb8b1c7f..4f42082aeb0687f94a0e3f54ecbd8e004120cf30 100644 --- a/product/ERP5/ERP5Site.py +++ b/product/ERP5/ERP5Site.py @@ -1451,6 +1451,19 @@ class ERP5Generator(PortalGenerator): keep = 0 portal_activities.manageClearActivities(keep=keep) + # Add several other tools, only at the end in order + # to make sure that they will be reindexed + addTool = p.manage_addProduct['ERP5'].manage_addTool + if not p.hasObject('portal_rules'): + addTool('ERP5 Rule Tool', None) + if not p.hasObject('portal_simulation'): + addTool('ERP5 Simulation Tool', None) + if not p.hasObject('portal_deliveries'): + addTool('ERP5 Delivery Tool', None) + if not p.hasObject('portal_orders'): + addTool('ERP5 Order Tool', None) + + def setupTemplateTool(self, p, **kw): """ Setup the Template Tool. Security must be set strictly. @@ -1493,12 +1506,8 @@ class ERP5Generator(PortalGenerator): addTool = p.manage_addProduct['ERP5'].manage_addTool if not p.hasObject('portal_categories'): addTool('ERP5 Categories', None) - if not p.hasObject('portal_rules'): - addTool('ERP5 Rule Tool', None) if not p.hasObject('portal_ids'): addTool('ERP5 Id Tool', None) - if not p.hasObject('portal_simulation'): - addTool('ERP5 Simulation Tool', None) if not p.hasObject('portal_templates'): self.setupTemplateTool(p) if not p.hasObject('portal_trash'): @@ -1507,10 +1516,6 @@ class ERP5Generator(PortalGenerator): addTool('ERP5 Alarm Tool', None) if not p.hasObject('portal_domains'): addTool('ERP5 Domain Tool', None) - if not p.hasObject('portal_deliveries'): - addTool('ERP5 Delivery Tool', None) - if not p.hasObject('portal_orders'): - addTool('ERP5 Order Tool', None) if not p.hasObject('portal_tests'): addTool('ERP5 Test Tool', None) if not p.hasObject('portal_password'): @@ -1774,7 +1779,7 @@ class ERP5Generator(PortalGenerator): portal_catalog.getSQLCatalog().z0_drop_portal_ids() # Then clear the catalog and reindex it portal_catalog.manage_catalogClear() - skins_tool["erp5_core"].ERP5Site_reindexAll() + # Calling ERP5Site_reindexAll is useless. def setupUserFolder(self, p): # We use if possible ERP5Security, then NuxUserGroups