[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.
This commit is contained in:
StefanRijnhart 2014-07-29 12:17:38 +02:00 committed by Martin Trigaux
parent c544a906b8
commit f9da53743f
1 changed files with 2 additions and 1 deletions

View File

@ -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)