From f9da53743f2c12bf12e93c6004c0107249962805 Mon Sep 17 00:00:00 2001 From: StefanRijnhart Date: Tue, 29 Jul 2014 12:17:38 +0200 Subject: [PATCH] [FIX] mail: reset of default_type in context When creating a new message, we need to reset the default_type key to avoid context propagation (e.g. invoice menu). However we used to compare the key in context (char) with the list of selections (tuple) so it was never matching and always reset. --- addons/mail/mail_message.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/mail/mail_message.py b/addons/mail/mail_message.py index 3f491df82b7..8ac047fb77e 100644 --- a/addons/mail/mail_message.py +++ b/addons/mail/mail_message.py @@ -61,7 +61,8 @@ class mail_message(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) - if context and context.get('default_type') and context.get('default_type') not in self._columns['type'].selection: + if context and context.get('default_type') and context.get('default_type') not in [ + val[0] for val in self._columns['type'].selection]: context = dict(context, default_type=None) return super(mail_message, self).default_get(cr, uid, fields, context=context)