[FIX] mail: _fields['type'].selection is a callable
authorDenis Ledoux <dle@odoo.com>
Fri, 7 Nov 2014 11:34:04 +0000 (12:34 +0100)
committerDenis Ledoux <dle@odoo.com>
Fri, 7 Nov 2014 11:36:10 +0000 (12:36 +0100)
This revert partially the rev. f2e4a10e1a58c932f9a989e642771f5ae75d756a

  File "/home/odoo/src/odoo/8.0/addons/mail/mail_mail.py", line 76, in default_get
      if context and context.get('default_type') and context.get('default_type') not in self._fields['type'].selection:
      TypeError: argument of type 'function' is not iterable

addons/mail/mail_mail.py

index 482db7a..db4a0ac 100644 (file)
@@ -73,7 +73,7 @@ class mail_mail(osv.Model):
     def default_get(self, cr, uid, fields, context=None):
         # protection for `default_type` values leaking from menu action context (e.g. for invoices)
         # To remove when automatic context propagation is removed in web client
-        if context and context.get('default_type') and context.get('default_type') not in self._fields['type'].selection:
+        if context and context.get('default_type') and context.get('default_type') not in self._all_columns['type'].column.selection:
             context = dict(context, default_type=None)
         return super(mail_mail, self).default_get(cr, uid, fields, context=context)