[MERGE] server action: fix missing active_model in context when calling server action run()

bzr revid: xal@openerp.com-20120426080300-ufex83412qnuzfwe
This commit is contained in:
Xavier ALT 2012-04-26 10:03:00 +02:00
commit 20d2d1215f
2 changed files with 3 additions and 3 deletions

View File

@ -390,7 +390,7 @@ the rule to mark CC(mail to any other person defined in actions)."),
context = {}
if action.server_action_id:
context.update({'active_id':obj.id, 'active_ids':[obj.id]})
context.update({'active_id': obj.id, 'active_ids': [obj.id], 'active_model': obj._name})
self.pool.get('ir.actions.server').run(cr, uid, [action.server_action_id.id], context)
write = {}

View File

@ -194,7 +194,7 @@ openerp_mailgate.py -u %(uid)d -p PASSWORD -o %(model)s -d %(dbname)s --host=HOS
strip_attachments=(not server.attach),
context=context)
if res_id and server.action_id:
action_pool.run(cr, uid, [server.action_id.id], {'active_id': res_id, 'active_ids':[res_id]})
action_pool.run(cr, uid, [server.action_id.id], {'active_id': res_id, 'active_ids': [res_id], 'active_model': server.object_id.model})
imap_server.store(num, '+FLAGS', '\\Seen')
cr.commit()
count += 1
@ -219,7 +219,7 @@ openerp_mailgate.py -u %(uid)d -p PASSWORD -o %(model)s -d %(dbname)s --host=HOS
strip_attachments=(not server.attach),
context=context)
if res_id and server.action_id:
action_pool.run(cr, uid, [server.action_id.id], {'active_id': res_id, 'active_ids':[res_id]})
action_pool.run(cr, uid, [server.action_id.id], {'active_id': res_id, 'active_ids': [res_id], 'active_model': server.object_id.model})
pop_server.dele(num)
cr.commit()
logger.info("fetched/processed %s email(s) on %s server %s", numMsgs, server.type, server.name)