[FIX] project: when writing on several projects, don't erase the name of all projects with the last one's name! stupid me.

bzr revid: qdp-launchpad@openerp.com-20130307075131-1cuhwonymijqueq8
This commit is contained in:
Quentin (OpenERP) 2013-03-07 08:51:31 +01:00
commit 30ea400bd1
1 changed files with 6 additions and 5 deletions

View File

@ -1302,13 +1302,13 @@ class account_analytic_account(osv.osv):
return analytic_account_id
def write(self, cr, uid, ids, vals, context=None):
name = vals.get('name')
vals_for_project = vals.copy()
for account in self.browse(cr, uid, ids, context=context):
if not name:
vals['name'] = account.name
if not vals.get('name'):
vals_for_project['name'] = account.name
if not vals.get('type'):
vals['type'] = account.type
self.project_create(cr, uid, account.id, vals, context=context)
vals_for_project['type'] = account.type
self.project_create(cr, uid, account.id, vals_for_project, context=context)
return super(account_analytic_account, self).write(cr, uid, ids, vals, context=context)
def unlink(self, cr, uid, ids, *args, **kwargs):
@ -1425,3 +1425,4 @@ class project_category(osv.osv):
_columns = {
'name': fields.char('Name', size=64, required=True, translate=True),
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: