From c4476c4ad3d5953c5677127aa542f1ce61816f53 Mon Sep 17 00:00:00 2001 From: "Turkesh Patel (Open ERP)" Date: Mon, 2 Jul 2012 17:46:46 +0530 Subject: [FIX] plugin:when create the partner from the thunderbird at that time create partner two times. bzr revid: tpa@tinyerp.com-20120702121646-bzom7r2buerwj5n7 --- addons/plugin/plugin_handler.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'addons/plugin/plugin_handler.py') diff --git a/addons/plugin/plugin_handler.py b/addons/plugin/plugin_handler.py index 700b9648237..2de179f6744 100644 --- a/addons/plugin/plugin_handler.py +++ b/addons/plugin/plugin_handler.py @@ -126,9 +126,10 @@ class plugin_handler(osv.osv_memory): partner_obj = self.pool.get('res.partner') dictcreate = dict(data) if partner_id == 0: - partner_id = partner_obj.create(cr, uid, {'name':dictcreate.get('name')}) - dictcreate['partner_id'] = partner_id - self.pool.get('res.partner').create(cr, uid, dictcreate) + partner_id = partner_obj.create(cr, uid, dictcreate) + else: + dictcreate['parent_id'] = partner_id + partner_obj.create(cr, uid, dictcreate) url = self._make_url(cr, uid, partner_id, 'res.partner') return ('res.partner', partner_id, url) -- cgit v1.2.3 From edfac27fac7696f61d616919ab74fd59dd9488d2 Mon Sep 17 00:00:00 2001 From: "Turkesh Patel (Open ERP)" Date: Mon, 2 Jul 2012 18:29:26 +0530 Subject: [IMP] improved code bzr revid: tpa@tinyerp.com-20120702125926-r9mtwclvb9mrm5f7 --- addons/plugin/plugin_handler.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'addons/plugin/plugin_handler.py') diff --git a/addons/plugin/plugin_handler.py b/addons/plugin/plugin_handler.py index 2de179f6744..a026eb61d4b 100644 --- a/addons/plugin/plugin_handler.py +++ b/addons/plugin/plugin_handler.py @@ -125,11 +125,9 @@ class plugin_handler(osv.osv_memory): """ partner_obj = self.pool.get('res.partner') dictcreate = dict(data) - if partner_id == 0: - partner_id = partner_obj.create(cr, uid, dictcreate) - else: + if partner_id: dictcreate['parent_id'] = partner_id - partner_obj.create(cr, uid, dictcreate) + partner_id = partner_obj.create(cr, uid, dictcreate) url = self._make_url(cr, uid, partner_id, 'res.partner') return ('res.partner', partner_id, url) -- cgit v1.2.3 From 6125b3bd91f092b412fea5260d89ba7a9416e62b Mon Sep 17 00:00:00 2001 From: "Pinakin Nayi (OpenERP)" Date: Fri, 7 Sep 2012 19:07:06 +0530 Subject: [IMP]thunderbird partner push mail bzr revid: pna@tinyerp.com-20120907133706-dhjr12dox3u0g1n0 --- addons/plugin/plugin_handler.py | 2 -- 1 file changed, 2 deletions(-) (limited to 'addons/plugin/plugin_handler.py') 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" -- cgit v1.2.3 From ba4a192eebb65a0282450859b4d3b20c95f70ab7 Mon Sep 17 00:00:00 2001 From: "Pinakin Nayi (OpenERP)" Date: Tue, 11 Sep 2012 17:37:59 +0530 Subject: [IMP]thunderbird method change bzr revid: pna@tinyerp.com-20120911120759-oh7ppu9lhvigj8ng --- addons/plugin/plugin_handler.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'addons/plugin/plugin_handler.py') 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] -- cgit v1.2.3 From 77efac80dde9cf19a00bdbf2f98afa24a87f5673 Mon Sep 17 00:00:00 2001 From: "Pinakin Nayi (OpenERP)" Date: Wed, 12 Sep 2012 10:46:47 +0530 Subject: [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(-) (limited to 'addons/plugin/plugin_handler.py') 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 -- cgit v1.2.3 From 989ce9204b9d6ade19a609805b7b2ba22c5d5b8b Mon Sep 17 00:00:00 2001 From: "Harry (OpenERP)" Date: Thu, 13 Sep 2012 12:47:24 +0530 Subject: [FIX] plugin: should call message_process instead of message_new for new message bzr revid: hmo@tinyerp.com-20120913071724-re6w0fy6jspldsjh --- addons/plugin/plugin_handler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/plugin/plugin_handler.py') diff --git a/addons/plugin/plugin_handler.py b/addons/plugin/plugin_handler.py index 8f0fdc1ad8e..dee2cac117d 100644 --- a/addons/plugin/plugin_handler.py +++ b/addons/plugin/plugin_handler.py @@ -103,7 +103,7 @@ class plugin_handler(osv.osv_memory): if model == 'res.partner': notify = 'User the Partner button to create a new partner' else: - res_id = model_obj.message_new(cr, uid, msg) + res_id = model_obj.message_process(cr, uid, model, email) notify = "Mail successfully pushed, a new %s has been created " % model else: model_obj.message_post(cr, uid, [res_id], -- cgit v1.2.3 From a8d177d97acf7abe40a8530dd7734124f05dfbea Mon Sep 17 00:00:00 2001 From: "Harry (OpenERP)" Date: Thu, 13 Sep 2012 13:16:31 +0530 Subject: [FIX] plugin: fix issue in document_get method bzr revid: hmo@tinyerp.com-20120913074631-vbjgdywt03x8eqbp --- addons/plugin/plugin_handler.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'addons/plugin/plugin_handler.py') 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) -- cgit v1.2.3 From fab90cb7d47f2173bb27616bf15094ad92118e2f Mon Sep 17 00:00:00 2001 From: "Harry (OpenERP)" Date: Thu, 13 Sep 2012 13:22:23 +0530 Subject: [FIX] plugin: fix issue bzr revid: hmo@tinyerp.com-20120913075223-5s0eeg4a7dlqat1m --- addons/plugin/plugin_handler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/plugin/plugin_handler.py') diff --git a/addons/plugin/plugin_handler.py b/addons/plugin/plugin_handler.py index 3e2f09d8789..983f3d60dfc 100644 --- a/addons/plugin/plugin_handler.py +++ b/addons/plugin/plugin_handler.py @@ -48,7 +48,7 @@ class plugin_handler(osv.osv_memory): 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_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) -- cgit v1.2.3 From 21a6ba351922bd25a75a7e48e8448984d8c87458 Mon Sep 17 00:00:00 2001 From: "Harry (OpenERP)" Date: Thu, 13 Sep 2012 13:55:35 +0530 Subject: [FIX] plugin: first search message_id than search parent message if not found bzr revid: hmo@tinyerp.com-20120913082535-syibk95l0kmz60nw --- addons/plugin/plugin_handler.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'addons/plugin/plugin_handler.py') diff --git a/addons/plugin/plugin_handler.py b/addons/plugin/plugin_handler.py index 983f3d60dfc..42754951317 100644 --- a/addons/plugin/plugin_handler.py +++ b/addons/plugin/plugin_handler.py @@ -45,11 +45,14 @@ class plugin_handler(osv.osv_memory): url = "" name = "" msg = self.pool.get('mail.thread').message_parse(cr, uid, email) - msg_id = msg.get('parent_id', False) + parent_id = msg.get('parent_id', False) message_id = msg.get('message_id') - if not msg_id: + msg_id = False + if message_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 not msg_id and parent_id: + msg_id = parent_id if msg_id: msg = mail_message_obj.browse(cr, uid, msg_id) res_id = msg.res_id -- cgit v1.2.3