From 06d08603cc5a09eb7e8eaa064ee572234d49fd30 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Tue, 8 Jan 2013 15:20:21 +0100 Subject: [PATCH] [FIX] mail: when creating a new object from incoming mail, don't call default_get before the call to super(). The create method from the orm is adding default missing value itself. It is also the cause of a bug on stage selection because custom code in create() is not run when stage_id is given in vals (and it's filled here by default_get() but return a wrong value as context cannot be used from incomming mail). bzr revid: qdp-launchpad@openerp.com-20130108142021-thtla3868hqvqs0o --- addons/mail/mail_thread.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index af18abb67e5..cb6d5856517 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -647,14 +647,14 @@ class mail_thread(osv.AbstractModel): """ if context is None: context = {} + data = {} + if isinstance(custom_values, dict): + data = custom_values.copy() model = context.get('thread_model') or self._name model_pool = self.pool.get(model) fields = model_pool.fields_get(cr, uid, context=context) - data = model_pool.default_get(cr, uid, fields, context=context) if 'name' in fields and not data.get('name'): data['name'] = msg_dict.get('subject', '') - if custom_values and isinstance(custom_values, dict): - data.update(custom_values) res_id = model_pool.create(cr, uid, data, context=context) return res_id