[FIX]: move action code from fetchmail to crm module to make fetchmail standards.

bzr revid: mga@tinyerp.com-20100419174635-j8rabdai2gd02qso
This commit is contained in:
Mantavya Gajjar 2010-04-19 23:16:35 +05:30
parent 08d7ecffc2
commit 1ff23a26ba
2 changed files with 15 additions and 22 deletions

View File

@ -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)

View File

@ -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: