From 8c9987503e3d1cac0e0bfa3781fa1bf6d5ab42fb Mon Sep 17 00:00:00 2001 From: "Harry (Open ERP)" Date: Tue, 5 Jan 2010 18:20:51 +0530 Subject: [PATCH] [FIX] mail_gate : update record after geeting reply from user/partner bzr revid: hmo@tinyerp.com-20100105125051-ctzfukx7jd4ws567 --- addons/crm/crm_mailgate.py | 8 ++++---- addons/mail_gateway/mail_gateway.py | 11 ++++++----- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/addons/crm/crm_mailgate.py b/addons/crm/crm_mailgate.py index 0d6844cd021..5c8712a77d5 100644 --- a/addons/crm/crm_mailgate.py +++ b/addons/crm/crm_mailgate.py @@ -52,7 +52,7 @@ class crm_cases(osv.osv): data.update(res) return self.create(cr, uid, data) - def msg_update(self, cr, uid, id, msg, data={}, default_act='pending'): + def msg_update(self, cr, uid, ids, msg, data={}, default_act='pending'): mailgate_obj = self.pool.get('mail.gateway') msg_actions, body_data = mailgate_obj.msg_act_get(msg) data.update({ @@ -77,9 +77,9 @@ class crm_cases(osv.osv): if 'partner' in msg_actions: data['email_from'] = msg_actions['partner'][:128] - self.write(cr, uid, [id], data) - getattr(self,act)(cr, uid, [id]) - return True + res = self.write(cr, uid, ids, data) + getattr(self,act)(cr, uid, ids) + return res def emails_get(self, cr, uid, ids, context={}): res = [] diff --git a/addons/mail_gateway/mail_gateway.py b/addons/mail_gateway/mail_gateway.py index a2b406e4da9..79af391bf46 100644 --- a/addons/mail_gateway/mail_gateway.py +++ b/addons/mail_gateway/mail_gateway.py @@ -155,7 +155,7 @@ class mail_gateway(osv.osv): res_id, note = self.parse_mail(cr, uid, mailgateway.id, data[0][1]) log = '' if res_id: - log = _('Object Successfully Created : %d of %s'% (res_id, res_model)) + log = _('Object Successfully Created/Modified: %d of %s'% (res_id, res_model)) if note: log = note log_messages.append(log) @@ -280,14 +280,14 @@ class mail_gateway(osv.osv): def msg_user(self, cr, uid, msg, res_id, res_model): actions, body_data = self.msg_act_get(msg) - + data = {} if 'user' in actions: uids = self.pool.get('res.users').name_search(cr, uid, actions['user']) if uids: data['user_id'] = uids[0][0] res_model = self.pool.get(res_model) - return res_model.msg_update(cr, uid, msg, res_id, data=data, default_act='pending') + return res_model.msg_update(cr, uid, res_id, msg, data=data, default_act='pending') def msg_send(self, msg, reply_to, emails, priority=None, res_id=False): if not emails: @@ -305,7 +305,7 @@ class mail_gateway(osv.osv): def msg_partner(self, cr, uid, msg, res_id, res_model): res_model = self.pool.get(res_model) - return res_model.msg_update(cr, uid, msg, res_id, data=data, default_act='open') + return res_model.msg_update(cr, uid, res_id, msg, data={}, default_act='open') @@ -323,7 +323,8 @@ class mail_gateway(osv.osv): def msg_test(res_str): emails = ('', '', '', '') if not res_str: - return (False, emails) + return (False, emails) + res_str = int(res_str) if hasattr(self.pool.get(res_model), 'emails_get'): emails = self.pool.get(res_model).emails_get(cr, uid, [res_str])[0] return (res_str, emails)