[FIX] event: subscribe customer error

The onchange methods needs to work with browse records and address_get returns an id. Fixes #2484
This commit is contained in:
Martin Trigaux 2014-09-18 11:07:54 +02:00
parent e6a2d222d6
commit e31d25c867
1 changed files with 3 additions and 2 deletions

View File

@ -380,8 +380,9 @@ class event_registration(models.Model):
@api.onchange('partner_id')
def _onchange_partner(self):
if self.partner_id:
contact = self.partner_id.address_get().get('default', False)
if contact:
contact_id = self.partner_id.address_get().get('default', False)
if contact_id:
contact = self.env['res.partner'].browse(contact_id)
self.name = contact.name
self.email = contact.email
self.phone = contact.phone