summaryrefslogtreecommitdiff
path: root/addons/plugin
diff options
context:
space:
mode:
authorHarry (OpenERP) <hmo@tinyerp.com>2012-09-13 13:16:31 +0530
committerHarry (OpenERP) <hmo@tinyerp.com>2012-09-13 13:16:31 +0530
commita8d177d97acf7abe40a8530dd7734124f05dfbea (patch)
treecd0a6fa48222b8f02919415682bf8cd2a8934726 /addons/plugin
parent989ce9204b9d6ade19a609805b7b2ba22c5d5b8b (diff)
[FIX] plugin: fix issue in document_get method
bzr revid: hmo@tinyerp.com-20120913074631-vbjgdywt03x8eqbp
Diffstat (limited to 'addons/plugin')
-rw-r--r--addons/plugin/plugin_handler.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/addons/plugin/plugin_handler.py b/addons/plugin/plugin_handler.py
index dee2cac117d..3e2f09d8789 100644
--- a/addons/plugin/plugin_handler.py
+++ b/addons/plugin/plugin_handler.py
@@ -45,13 +45,13 @@ class plugin_handler(osv.osv_memory):
url = ""
name = ""
msg = self.pool.get('mail.thread').message_parse(cr, uid, email)
- references = [msg.get('message-id')]
- refs = msg.get('references',False)
- if refs:
- references.extend(refs.split())
- msg_ids = mail_message_obj.search(cr, uid, [('message_id','in',references)])
- if msg_ids:
- msg = mail_message_obj.browse(cr, uid, msg_ids[0])
+ msg_id = msg.get('parent_id', False)
+ message_id = msg.get('message_id')
+ if not msg_id:
+ msg_ids = mail_message_obj.search(cr, uid, ('message_id','=', message_id))
+ msg_id = len(msg_ids) and msg_ids[0] or False
+ if msg_id:
+ msg = mail_message_obj.browse(cr, uid, msg_id)
res_id = msg.res_id
model = msg.model
url = self._make_url(cr, uid, res_id, model)
@@ -80,7 +80,7 @@ class plugin_handler(osv.osv_memory):
@return : the result of name_search a list of tuple
[(id, 'name')]
"""
- return self.pool.get(model).name_search(cr,uid,name)
+ return self.pool.get(model).name_search(cr, uid, name)
def push_message(self, cr, uid, model, email, res_id=0):
"""
@@ -163,6 +163,6 @@ class plugin_handler(osv.osv_memory):
attach_ids.append(ir_attachment_obj.create(cr, uid, vals))
mail_ids = mail_message.search(cr, uid, [('message_id','=',message_id),('res_id','=',res_id),('model','=',model)])
if mail_ids:
- ids = mail_message.write(cr, uid,mail_ids[0],{ 'attachment_ids': [(6, 0, attach_ids)],'body':body,'body_html':body_html})
+ ids = mail_message.write(cr, uid, mail_ids[0], { 'attachment_ids': [(6, 0, attach_ids)],'body':body,'body_html':body_html})
url = self._make_url(cr, uid, res_id, model)
return (model, res_id, url)