[FIX]: creating a project from template was creating two analytic records for child projects, fixed it

bzr revid: pap@tinyerp.co.in-20100701061915-fyrw6y2vmjn7r58i
This commit is contained in:
pap (openerp)
2010-07-01 11:49:15 +05:30
parent 36b13c4073
commit 92dfe7844e
+3
View File
@@ -233,6 +233,9 @@ class account_analytic_account(osv.osv):
]
def create(self, cr, uid, vals, context=None):
if context.get('analytic_project_copy', False):
if vals.get('child_ids', False):
vals['child_ids'] = []
parent_id = vals.get('parent_id', 0)
if ('code' not in vals or not vals['code']) and not parent_id:
vals['code'] = self.pool.get('ir.sequence').get(cr, uid, 'account.analytic.account')