[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:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user