[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
This commit is contained in:
Quentin (OpenERP)
2013-01-08 15:20:21 +01:00
parent ff5b5d6cb1
commit 06d08603cc
+3 -3
View File
@@ -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