diff options
| author | Turkesh Patel (Open ERP) <tpa@tinyerp.com> | 2011-12-28 14:57:37 +0530 |
|---|---|---|
| committer | Turkesh Patel (Open ERP) <tpa@tinyerp.com> | 2011-12-28 14:57:37 +0530 |
| commit | e6d719579a3c5a26d96e15a9c35f33a6fd5e6a56 (patch) | |
| tree | 3c7fbee232073326555f29c784efcb3c0ac8d6a4 /addons/plugin/plugin_handler.py | |
| parent | ddc528e7b54df9a33354b1cecd12d0bfbbcb62bc (diff) | |
| parent | 031ecd675caaa87481768edc197df51c23486f96 (diff) | |
[MRG] Merge with main addons.
bzr revid: tpa@tinyerp.com-20111228092737-ss3xlu5o4b0ayg7f
Diffstat (limited to 'addons/plugin/plugin_handler.py')
| -rw-r--r-- | addons/plugin/plugin_handler.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/addons/plugin/plugin_handler.py b/addons/plugin/plugin_handler.py index 1fccae814b2..ef990170e64 100644 --- a/addons/plugin/plugin_handler.py +++ b/addons/plugin/plugin_handler.py @@ -39,9 +39,9 @@ class plugin_handler(osv.osv_memory): (model_name, res_id, url, name_get) """ mail_message_obj = self.pool.get('mail.message') - model = False + model = "" res_id = 0 - url = False + url = "" name = "" msg = mail_message_obj.parse_message(email) references = [msg.get('message-id')] @@ -93,6 +93,7 @@ class plugin_handler(osv.osv_memory): msg = mail_message.parse_message(email) message_id = msg.get('message-id') mail_ids = mail_message.search(cr, uid, [('message_id','=',message_id),('res_id','=',res_id),('model','=',model)]) + if message_id and mail_ids : mail_record = mail_message.browse(cr, uid, mail_ids)[0] res_id = mail_record.res_id @@ -104,8 +105,12 @@ class plugin_handler(osv.osv_memory): res_id = model_obj.message_new(cr, uid, msg) notify = "Mail succefully pushed, a new %s has been created " % model else: - model_obj.message_append_dict(cr, uid, [res_id], msg) + if model == 'res.partner': + model_obj = self.pool.get('mail.thread') + res = self.pool.get(model).browse(cr, uid, [res_id]) + model_obj.message_append_dict(cr, uid, res, msg) notify = "Mail succefully pushed" + url = self._make_url(cr, uid, res_id, model) return (model, res_id, url, notify) |
