From 93720744cf95ca6e2f9928156aa77116afa02158 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Wed, 8 Aug 2012 20:15:22 +0200 Subject: [PATCH] [FIX] project: prevent double project creation when use_{tasks,issues} is check on analytic account bzr revid: odo@openerp.com-20120808181522-ajgmdy5wijxqyore --- addons/project/project.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/project/project.py b/addons/project/project.py index 7e1880646c7..707df5607c6 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -522,6 +522,9 @@ def Project(): return user_ids def create(self, cr, uid, vals, context=None): + if context is None: context = {} + # Prevent double project creation when 'use_tasks' is checked! + context = dict(context, project_creation_in_progress=True) mail_alias = self.pool.get('mail.alias') if not vals.get('alias_id'): name = vals.pop('alias_name', None) or vals['name'] @@ -1285,7 +1288,8 @@ class account_analytic_account(osv.osv): ''' This function is used to decide if a project needs to be automatically created or not when an analytic account is created. It returns True if it needs to be so, False otherwise. ''' - return vals.get('use_tasks') + if context is None: context = {} + return vals.get('use_tasks') and not 'project_creation_in_progress' in context def project_create(self, cr, uid, analytic_account_id, vals, context=None): '''