From b999a061d835a5e1695fa1b3883346a76e64a49b Mon Sep 17 00:00:00 2001 From: "Sanjay Gohel (Open ERP)" Date: Thu, 28 Jun 2012 12:07:29 +0530 Subject: [IMP]improve code where needed and replace res.partner instead of res.partner.address bzr revid: sgo@tinyerp.com-20120628063729-1ccb8c45pxa31025 --- addons/plugin/plugin_handler.py | 8 ++++---- 1 file changed, 4 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 ef990170e64..50d6b5e85a9 100644 --- a/addons/plugin/plugin_handler.py +++ b/addons/plugin/plugin_handler.py @@ -26,8 +26,8 @@ class plugin_handler(osv.osv_memory): return True def partner_get(self, cr, uid, address_email): - ids = self.pool.get('res.partner.address').search(cr, uid, [('partner_id', '!=', False), ('email', 'like', address_email)]) - res_id = ids and self.pool.get('res.partner.address').browse(cr, uid, ids[0]).partner_id.id or 0 + partner_obj = self.pool.get('res.partner') + res_id = partner_obj.search(cr, uid, [('email', 'like', address_email)]) or 0 url = self._make_url(cr, uid, res_id, 'res.partner') return ('res.partner', res_id , url) @@ -116,7 +116,7 @@ class plugin_handler(osv.osv_memory): def contact_create(self, cr, uid, data, partner_id): """ - @param data : the data use to create the res.partner.address + @param data : the data use to create the res.partner [('field_name', value)], field name is required @param partner_id : On which partner the address is attached if partner_id = 0 then create a new partner with the same name that the address @@ -127,7 +127,7 @@ class plugin_handler(osv.osv_memory): 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.address').create(cr, uid, dictcreate) + self.pool.get('res.partner').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 46f2c2c9ca8662de3c1c8fc79fbdb1355367bc49 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Thu, 28 Jun 2012 14:18:20 +0200 Subject: [IMP] improvements during code review bzr revid: qdp-launchpad@openerp.com-20120628121820-r8bxfzq38fy8pcgt --- addons/plugin/plugin_handler.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'addons/plugin/plugin_handler.py') diff --git a/addons/plugin/plugin_handler.py b/addons/plugin/plugin_handler.py index 50d6b5e85a9..700b9648237 100644 --- a/addons/plugin/plugin_handler.py +++ b/addons/plugin/plugin_handler.py @@ -27,7 +27,8 @@ class plugin_handler(osv.osv_memory): def partner_get(self, cr, uid, address_email): partner_obj = self.pool.get('res.partner') - res_id = partner_obj.search(cr, uid, [('email', 'like', address_email)]) or 0 + partner_ids = partner_obj.search(cr, uid, [('email', 'like', address_email)]) + res_id = partner_ids and partner_ids[0] or 0 url = self._make_url(cr, uid, res_id, 'res.partner') return ('res.partner', res_id , url) -- cgit v1.2.3 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 6c12d5b308982721e2151e5a9f98659f0e0be119 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Wed, 8 Aug 2012 14:02:14 +0200 Subject: [FIX] correct home and login urls bzr revid: chs@openerp.com-20120808120214-13k9qgzx8gu330cs --- 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 700b9648237..e497f902dc2 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): -- cgit v1.2.3 From cb944d66ea941a3f80025f56d576677fa9d1c59c Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Fri, 17 Aug 2012 09:02:18 +0200 Subject: [IMP] mail message bzr revid: fp@tinyerp.com-20120817070218-rp1ssuhwnf8raitf --- addons/plugin/plugin_handler.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'addons/plugin/plugin_handler.py') diff --git a/addons/plugin/plugin_handler.py b/addons/plugin/plugin_handler.py index e497f902dc2..aaf54d1ac2b 100644 --- a/addons/plugin/plugin_handler.py +++ b/addons/plugin/plugin_handler.py @@ -108,8 +108,7 @@ class plugin_handler(osv.osv_memory): 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) + model_obj.message_append_note(cr, uid, [res_id], body=msg) notify = "Mail succefully pushed" url = self._make_url(cr, uid, res_id, model) -- cgit v1.2.3 From b62858e83e21bdd80aaf38b6d1149e6c66dc54e1 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Fri, 17 Aug 2012 12:03:02 +0200 Subject: [IMP] Merging different ways of posting a message: message_append_note message_append_dict message_append --> merged all to message_post bzr revid: fp@tinyerp.com-20120817100302-bqsqv23ogrchslew --- 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 aaf54d1ac2b..1bf3645d646 100644 --- a/addons/plugin/plugin_handler.py +++ b/addons/plugin/plugin_handler.py @@ -108,7 +108,7 @@ class plugin_handler(osv.osv_memory): else: if model == 'res.partner': model_obj = self.pool.get('mail.thread') - model_obj.message_append_note(cr, uid, [res_id], body=msg) + model_obj.message_post(cr, uid, [res_id], body=msg) notify = "Mail succefully pushed" url = self._make_url(cr, uid, res_id, model) -- cgit v1.2.3 From 06f60b3517cd160030ef2cc7758830604649fee9 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Fri, 17 Aug 2012 14:06:06 +0200 Subject: [FIX] body_text --> body, not ure it's good enough bzr revid: fp@tinyerp.com-20120817120606-t97l9x2dguuv7kmp --- addons/plugin/plugin_handler.py | 4 ++-- 1 file changed, 2 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 1bf3645d646..d493501e1cc 100644 --- a/addons/plugin/plugin_handler.py +++ b/addons/plugin/plugin_handler.py @@ -132,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 @@ -160,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) -- cgit v1.2.3 From 5008e9cc84002797b2b4c8c43d10ab5e720bac8e Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Tue, 21 Aug 2012 23:15:28 +0200 Subject: [FIX] mail: fix parse_message calls for new signature - cr,uid needed bzr revid: odo@openerp.com-20120821211528-yyxyq1bqti5g3s5v --- addons/plugin/plugin_handler.py | 6 +++--- 1 file changed, 3 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 d493501e1cc..6d6262ddd22 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 = 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)]) @@ -146,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] -- cgit v1.2.3 From 406e58399fd1444cd5b83862d6493f59fcb08790 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Wed, 22 Aug 2012 13:34:39 +0200 Subject: [FIX] mail: unify message_post calls, fix typos, various lint cleanup bzr revid: odo@openerp.com-20120822113439-aoy7v4njs6o34tu5 --- addons/plugin/plugin_handler.py | 6 +++--- 1 file changed, 3 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 6d6262ddd22..9c582a8e3bf 100644 --- a/addons/plugin/plugin_handler.py +++ b/addons/plugin/plugin_handler.py @@ -101,15 +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') model_obj.message_post(cr, uid, [res_id], body=msg) - notify = "Mail succefully pushed" + notify = "Mail succesfully pushed" url = self._make_url(cr, uid, res_id, model) return (model, res_id, url, notify) -- 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