From 1ff23a26bada2f9f520af81b2849181ee74479f7 Mon Sep 17 00:00:00 2001 From: Mantavya Gajjar Date: Mon, 19 Apr 2010 23:16:35 +0530 Subject: [PATCH] [FIX]: move action code from fetchmail to crm module to make fetchmail standards. bzr revid: mga@tinyerp.com-20100419174635-j8rabdai2gd02qso --- addons/crm/crm_mailgate.py | 23 ++++++++++++++--------- addons/fetchmail/fetchmail.py | 14 +------------- 2 files changed, 15 insertions(+), 22 deletions(-) diff --git a/addons/crm/crm_mailgate.py b/addons/crm/crm_mailgate.py index 17d182728a3..ae6a1e2696c 100644 --- a/addons/crm/crm_mailgate.py +++ b/addons/crm/crm_mailgate.py @@ -90,15 +90,20 @@ class crm_cases(osv.osv): if msg.get('priority', False): vals['priority'] = msg.get('priority') -# act = 'case_'+default_act -# if 'state' in msg_actions: -# if msg_actions['state'] in ['draft','close','cancel','open','pending']: -# act = 'case_' + msg_actions['state'] - -# for k1,k2 in [('cost','planned_cost'),('revenue','planned_revenue'),('probability','probability')]: -# if k1 in msg_actions: -# data[k2] = float(msg_actions[k1]) - + maps = { + 'cost':'planned_cost', + 'revenue': 'planned_revenue', + 'probability':'probability' + } + vls = { } + for line in msg['body'].split('\n'): + line = line.strip() + res = command_re.match(line) + if res and maps.get(res.group(1).lower(), False): + key = maps.get(res.group(1).lower()) + vls[key] = res.group(2).lower() + + vals.update(vls) res = self.write(cr, uid, ids, vals) cases = self.browse(cr, uid, ids) message_id = context.get('references_id', False) diff --git a/addons/fetchmail/fetchmail.py b/addons/fetchmail/fetchmail.py index ec6a08bf73c..55ce4010b03 100644 --- a/addons/fetchmail/fetchmail.py +++ b/addons/fetchmail/fetchmail.py @@ -270,19 +270,7 @@ class mail_server(osv.osv): context.update({ 'references_id':ref[0] }) - maps = { - 'cost':'planned_cost', - 'revenue': 'planned_revenue', - 'probability':'probability' - } - vals = { } - for line in msg['body'].split('\n'): - line = line.strip() - res = command_re.match(line) - if res and maps.get(res.group(1).lower(), False): - key = maps.get(res.group(1).lower()) - vals[key] = res.group(2).lower() - + model_pool.message_update(cr, uid, [history.res_id], vals, msg, context=context) res_id = id else: