summaryrefslogtreecommitdiff
path: root/addons/plugin/plugin_handler.py
diff options
context:
space:
mode:
authorThibault Delavallée <tde@openerp.com>2012-01-11 13:55:55 +0100
committerThibault Delavallée <tde@openerp.com>2012-01-11 13:55:55 +0100
commit7fd25b30f3a4ee8c33a67296b220a5bc8b34178f (patch)
tree6853a6d6b7241984ddb24e0a2f662429ad1a968f /addons/plugin/plugin_handler.py
parent22d004658afc076662b0d41cf79a02a58d12bd63 (diff)
parent57bc6ec7d0819831a4b12dae95da04a774fe9335 (diff)
[MERGE] Merged with trunk addons
bzr revid: tde@openerp.com-20120111125555-04w1yb6ixiewz4yl
Diffstat (limited to 'addons/plugin/plugin_handler.py')
-rw-r--r--addons/plugin/plugin_handler.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/addons/plugin/plugin_handler.py b/addons/plugin/plugin_handler.py
index 8a9f2073c2d..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')]
@@ -54,7 +54,7 @@ class plugin_handler(osv.osv_memory):
res_id = msg.res_id
model = msg.model
url = self._make_url(cr, uid, res_id, model)
- name = self.pool.get(model).name_get(cr, uid, res_id)[0][1]
+ name = self.pool.get(model).name_get(cr, uid, [res_id])[0][1]
return (model,res_id, url,name)
@@ -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)