summaryrefslogtreecommitdiff
path: root/addons/plugin/plugin_handler.py
diff options
context:
space:
mode:
authorAntonin Bourguignon <abo@openerp.com>2012-09-12 17:49:11 +0200
committerAntonin Bourguignon <abo@openerp.com>2012-09-12 17:49:11 +0200
commit1cf6c7f877be3376fc309bc0ef4a88ee857896d7 (patch)
treeb2c4b7a86be4148ebe88ba007a1cd4aec6f75f79 /addons/plugin/plugin_handler.py
parent0c9c22e539d9621a3e6ac1673a81a0176893bb56 (diff)
parented63dc38d27728d99d10ea9bab6c778f58aae91b (diff)
[MERGE] latest trunk
bzr revid: abo@openerp.com-20120912154911-yx8qrqk855omoqbs
Diffstat (limited to 'addons/plugin/plugin_handler.py')
-rw-r--r--addons/plugin/plugin_handler.py21
1 files changed, 10 insertions, 11 deletions
diff --git a/addons/plugin/plugin_handler.py b/addons/plugin/plugin_handler.py
index 700b9648237..9c582a8e3bf 100644
--- a/addons/plugin/plugin_handler.py
+++ b/addons/plugin/plugin_handler.py
@@ -19,7 +19,7 @@ class plugin_handler(osv.osv_memory):
base_url = self.pool.get('ir.config_parameter').get_param(cr, uid, 'web.base.url', default='http://localhost:8069', context=context)
if base_url:
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
- base_url += '/web/webclient/login?db=%s&login=%s&key=%s#id=%s&model=%s' % (cr.dbname, user.login, user.password, res_id, model)
+ base_url += '/login?db=%s&login=%s&key=%s#id=%s&model=%s' % (cr.dbname, user.login, user.password, res_id, model)
return base_url
def is_installed(self, cr, uid):
@@ -44,7 +44,7 @@ class plugin_handler(osv.osv_memory):
res_id = 0
url = ""
name = ""
- msg = mail_message_obj.parse_message(email)
+ msg = self.pool.get('mail.thread').parse_message(cr, uid, email)
references = [msg.get('message-id')]
refs = msg.get('references',False)
if refs:
@@ -91,7 +91,7 @@ class plugin_handler(osv.osv_memory):
"""
mail_message = self.pool.get('mail.message')
model_obj = self.pool.get(model)
- msg = mail_message.parse_message(email)
+ msg = self.pool.get('mail.thread').parse_message(cr, uid, email)
message_id = msg.get('message-id')
mail_ids = mail_message.search(cr, uid, [('message_id','=',message_id),('res_id','=',res_id),('model','=',model)])
@@ -101,16 +101,15 @@ class plugin_handler(osv.osv_memory):
notify = "Email already pushed"
elif res_id == 0:
if model == 'res.partner':
- notify = 'User the button Partner to create a new partner'
+ notify = 'User the Partner button to create a new partner'
else:
res_id = model_obj.message_new(cr, uid, msg)
- notify = "Mail succefully pushed, a new %s has been created " % model
+ notify = "Mail succesfully pushed, a new %s has been created " % model
else:
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"
+ model_obj.message_post(cr, uid, [res_id], body=msg)
+ notify = "Mail succesfully pushed"
url = self._make_url(cr, uid, res_id, model)
return (model, res_id, url, notify)
@@ -133,7 +132,7 @@ class plugin_handler(osv.osv_memory):
return ('res.partner', partner_id, url)
# Specific to outlook rfc822 is not available so we split in arguments headerd,body,attachemnts
- def push_message_outlook(self, cr, uid, model, headers,res_id=0 ,body_text=False, body_html=False, attachments=False):
+ def push_message_outlook(self, cr, uid, model, headers,res_id=0 ,body=False, body_html=False, attachments=False):
# ----------------------------------------
# solution 1
# construct a fake rfc822 from the separated arguement
@@ -147,7 +146,7 @@ class plugin_handler(osv.osv_memory):
mail_message = self.pool.get('mail.message')
ir_attachment_obj = self.pool.get('ir.attachment')
attach_ids = []
- msg = mail_message.parse_message(headers)
+ msg = self.pool.get('mail.thread').parse_message(cr, uid, headers)
message_id = msg.get('message-id')
push_mail = self.push_message(cr, uid, model, headers, res_id)
res_id = push_mail[1]
@@ -161,6 +160,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_text':body_text,'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)