[FIX] event: subscribe customer error
authorMartin Trigaux <mat@openerp.com>
Thu, 18 Sep 2014 09:07:54 +0000 (11:07 +0200)
committerMartin Trigaux <mat@openerp.com>
Thu, 18 Sep 2014 09:08:19 +0000 (11:08 +0200)
The onchange methods needs to work with browse records and address_get returns an id. Fixes #2484

addons/event/event.py

index 0ee90ea..0fb7501 100644 (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