[FIX] res_company: some information missed on company creation

On the `res.company` model, the fields
`name`, `phone`, `email`, `website`, `vat` are
related field on the `partner_id` of the company.

When creating a new company, the partner
associated to the company is created automatically,
it's handled in the overrided `create` method
of the model, but it forgots the values
`phone`, `email`, `website`, `vat` at the moment
the partner is being created.

opw-675526
This commit is contained in:
Denis Ledoux 2016-04-25 12:33:19 +02:00
parent 0410d1187b
commit dc1b8a5a51
1 changed files with 10 additions and 1 deletions

View File

@ -276,7 +276,16 @@ class res_company(osv.osv):
self.cache_restart(cr)
return super(res_company, self).create(cr, uid, vals, context=context)
obj_partner = self.pool.get('res.partner')
partner_id = obj_partner.create(cr, uid, {'name': vals['name'], 'is_company':True, 'image': vals.get('logo', False), 'customer': False}, context=context)
partner_id = obj_partner.create(cr, uid, {
'name': vals['name'],
'is_company': True,
'image': vals.get('logo', False),
'customer': False,
'email': vals.get('email'),
'phone': vals.get('phone'),
'website': vals.get('website'),
'vat': vals.get('vat'),
}, context=context)
vals.update({'partner_id': partner_id})
self.cache_restart(cr)
company_id = super(res_company, self).create(cr, uid, vals, context=context)