From 6125b3bd91f092b412fea5260d89ba7a9416e62b Mon Sep 17 00:00:00 2001 From: "Pinakin Nayi (OpenERP)" Date: Fri, 7 Sep 2012 19:07:06 +0530 Subject: [PATCH 1/4] [IMP]thunderbird partner push mail bzr revid: pna@tinyerp.com-20120907133706-dhjr12dox3u0g1n0 --- addons/plugin/plugin_handler.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/addons/plugin/plugin_handler.py b/addons/plugin/plugin_handler.py index 96d93afc025..ec4217381af 100644 --- a/addons/plugin/plugin_handler.py +++ b/addons/plugin/plugin_handler.py @@ -106,8 +106,6 @@ class plugin_handler(osv.osv_memory): res_id = model_obj.message_new(cr, uid, msg) notify = "Mail succesfully pushed, a new %s has been created " % model else: - if model == 'res.partner': - model_obj = self.pool.get('mail.thread') model_obj.message_post(cr, uid, [res_id], body=msg) notify = "Mail succesfully pushed" From ba4a192eebb65a0282450859b4d3b20c95f70ab7 Mon Sep 17 00:00:00 2001 From: "Pinakin Nayi (OpenERP)" Date: Tue, 11 Sep 2012 17:37:59 +0530 Subject: [PATCH 2/4] [IMP]thunderbird method change bzr revid: pna@tinyerp.com-20120911120759-oh7ppu9lhvigj8ng --- addons/plugin/plugin_handler.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/addons/plugin/plugin_handler.py b/addons/plugin/plugin_handler.py index ec4217381af..5c0d551fbb7 100644 --- a/addons/plugin/plugin_handler.py +++ b/addons/plugin/plugin_handler.py @@ -44,7 +44,7 @@ class plugin_handler(osv.osv_memory): res_id = 0 url = "" name = "" - msg = self.pool.get('mail.thread').parse_message(cr, uid, email) + msg = self.pool.get('mail.thread').message_parse(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 = self.pool.get('mail.thread').parse_message(cr, uid, email) + msg = self.pool.get('mail.thread').message_parse(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)]) @@ -104,11 +104,15 @@ class plugin_handler(osv.osv_memory): notify = 'User the Partner button to create a new partner' else: res_id = model_obj.message_new(cr, uid, msg) - notify = "Mail succesfully pushed, a new %s has been created " % model + notify = "Mail successfully pushed, a new %s has been created " % model else: - model_obj.message_post(cr, uid, [res_id], body=msg) - notify = "Mail succesfully pushed" - + model_obj.message_post(cr, uid, [res_id], + body= msg.get('body'), + subject= msg.get('subject'), + type= 'notification', + parent_id= msg.get('parent_id'), + attachments= msg.get('attachments')) + notify = "Mail successfully pushed" url = self._make_url(cr, uid, res_id, model) return (model, res_id, url, notify) @@ -145,7 +149,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 = self.pool.get('mail.thread').parse_message(cr, uid, headers) + msg = self.pool.get('mail.thread').message_parse(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] From 77efac80dde9cf19a00bdbf2f98afa24a87f5673 Mon Sep 17 00:00:00 2001 From: "Pinakin Nayi (OpenERP)" Date: Wed, 12 Sep 2012 10:46:47 +0530 Subject: [PATCH 3/4] [IMP]thunderbird create partner pass context bzr revid: pna@tinyerp.com-20120912051647-p3nk3iu5at4byxyc --- addons/plugin/plugin_handler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/plugin/plugin_handler.py b/addons/plugin/plugin_handler.py index 5c0d551fbb7..f713b2c8ee8 100644 --- a/addons/plugin/plugin_handler.py +++ b/addons/plugin/plugin_handler.py @@ -116,7 +116,7 @@ class plugin_handler(osv.osv_memory): url = self._make_url(cr, uid, res_id, model) return (model, res_id, url, notify) - def contact_create(self, cr, uid, data, partner_id): + def contact_create(self, cr, uid, data, partner_id, context=None): """ @param data : the data use to create the res.partner [('field_name', value)], field name is required From 04f0a3f50fbb08086f28fbbe796d3201fb65320f Mon Sep 17 00:00:00 2001 From: "Pinakin Nayi (OpenERP)" Date: Wed, 12 Sep 2012 11:28:27 +0530 Subject: [PATCH 4/4] [IMP]thunderbird add attachment bzr revid: pna@tinyerp.com-20120912055827-tc5dt2ahfstz47ma --- addons/mail/mail_thread.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index c0d6ac90fe6..59bdf8f36c6 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -584,6 +584,7 @@ class mail_thread(osv.AbstractModel): if isinstance(thread_id, (list, tuple)): thread_id = thread_id and thread_id[0] + ir_attachment = self.pool.get('ir.attachment') attachment_ids = [] for name, content in attachments: if isinstance(content, unicode): @@ -596,7 +597,7 @@ class mail_thread(osv.AbstractModel): 'res_model': context.get('thread_model') or self._name, 'res_id': thread_id, } - attachment_ids.append((0, 0, data_attach)) + attachment_ids.append(ir_attachment.create(cr, uid, data_attach, context=context)) values = kwargs values.update({