[IMP] analytic: if a partner is given and there is no name, automatically fill the name of the analytic account

bzr revid: qdp-launchpad@openerp.com-20120614134511-tdjqtx6hvge6h92e
This commit is contained in:
Quentin (OpenERP) 2012-06-14 15:45:11 +02:00
parent 80be8440fa
commit 2d2ee773ac
1 changed files with 5 additions and 2 deletions

View File

@ -184,8 +184,11 @@ class account_analytic_account(osv.osv):
def on_change_partner_id(self, cr, uid, ids,partner_id, name, context={}):
res={}
if partner_id:
part = self.pool.get('res.partner').browse(cr, uid, partner_id,context=context)
if part.user_id:res['manager_id'] = part.user_id.id
partner = self.pool.get('res.partner').browse(cr, uid, partner_id, context=context)
if partner.user_id:
res['manager_id'] = partner.user_id.id
if not name:
res['name'] = _('Contract: ') + partner.name
return {'value': res}
def _default_company(self, cr, uid, context=None):