[FIX] mail: when creating a new object from incoming mail, don't call default_get...
authorQuentin (OpenERP) <qdp-launchpad@openerp.com>
Tue, 8 Jan 2013 14:20:21 +0000 (15:20 +0100)
committerQuentin (OpenERP) <qdp-launchpad@openerp.com>
Tue, 8 Jan 2013 14:20:21 +0000 (15:20 +0100)
bzr revid: qdp-launchpad@openerp.com-20130108142021-thtla3868hqvqs0o

addons/mail/mail_thread.py

index af18abb..cb6d585 100644 (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