Commit 5c4e8c60 authored by Julien Muchembled's avatar Julien Muchembled

Clear activity table unconditionally when a site is created

Tests like testComplexTradeModelLineUseCase were failing without --portal_id=
because a new site was created whereas there were remaining activities from
previously run tests.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@41596 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent cc830779
......@@ -4688,12 +4688,7 @@ Business Template is a set of definitions, such as skins, portal types and categ
gen = generator_class()
# update activity tool first if necessary
if self.getTitle() == 'erp5_core' and self.getTemplateUpdateTool():
if not site.hasObject('portal_activities'):
create_activities = True
LOG('Business Template', 0, 'Updating Activity Tool')
else:
create_activities = False
gen.setupLastTools(site, update=1, create_activities=create_activities)
gen.setupLastTools(site)
if not force:
if len(object_to_update) == 0:
# check if we have to update tools
......
......@@ -1573,25 +1573,18 @@ class ERP5Generator(PortalGenerator):
reindex=reindex, **kw)
return p
def setupLastTools(self, p, **kw):
def setupLastTools(self, p, create_activities=True, **kw):
"""
Set up finals tools
We want to set the activity tool only at the end to
make sure that we do not put un the queue the full reindexation
"""
# Add Activity Tool
if kw.get('create_activities', False):
if not p.hasObject('portal_activities'):
addTool = p.manage_addProduct['CMFActivity'].manage_addTool
addTool('CMF Activity Tool', None) # Allow user to select active/passive
if create_activities and not p.hasObject('portal_activities'):
addTool = p.manage_addProduct['CMFActivity'].manage_addTool
addTool('CMF Activity Tool', None) # Allow user to select active/passive
# Initialize Activities
portal_activities = getToolByName(p, 'portal_activities', None)
if portal_activities is not None:
if kw.get('update', 0):
keep = 1
else:
keep = 0
portal_activities.manageClearActivities(keep=keep)
p.portal_activities.manageClearActivities(keep=0)
# Add several other tools, only at the end in order
# to make sure that they will be reindexed
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment