From e2193e8a31e24b66b3b07fb6cd5a5dcd8e3a449e Mon Sep 17 00:00:00 2001 From: "Rucha (Open ERP)" Date: Tue, 28 Jun 2011 17:01:31 +0530 Subject: [PATCH 1/2] [IMP]: ir.actions.todo: When we pass res_id in the context of the action it should open the resource bzr revid: rpa@tinyerp.com-20110628113131-qhnp7qnirsqa2z4g --- openerp/addons/base/ir/ir_actions.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/openerp/addons/base/ir/ir_actions.py b/openerp/addons/base/ir/ir_actions.py index fa0fef36ef1..a057122c92a 100644 --- a/openerp/addons/base/ir/ir_actions.py +++ b/openerp/addons/base/ir/ir_actions.py @@ -844,6 +844,12 @@ class ir_actions_todo(osv.osv): wizard = self.browse(cr, uid, wizard_id, context=context) res = self.pool.get('ir.actions.act_window').read(cr, uid, wizard.action_id.id, [], context=context) res.update({'nodestroy': True}) + + # Open Specific resouce when res_id is provided in context + if res.get('context', {}): + ctx = eval(res['context']) + if ctx.get('res_id'): + res.update({'res_id': ctx.get('res_id')}) return res def action_open(self, cr, uid, ids, context=None): From 168e50d7f204fddbada4e43446be852a33fbe4b7 Mon Sep 17 00:00:00 2001 From: "Rucha (Open ERP)" Date: Tue, 28 Jun 2011 17:28:55 +0530 Subject: [PATCH 2/2] [IMP]: ir.actions.todo: Improvement in code in order to eval user.company_id.id in the context bzr revid: rpa@tinyerp.com-20110628115855-kf0318w22mtnggil --- openerp/addons/base/ir/ir_actions.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openerp/addons/base/ir/ir_actions.py b/openerp/addons/base/ir/ir_actions.py index a057122c92a..98770ed1ad9 100644 --- a/openerp/addons/base/ir/ir_actions.py +++ b/openerp/addons/base/ir/ir_actions.py @@ -847,7 +847,8 @@ class ir_actions_todo(osv.osv): # Open Specific resouce when res_id is provided in context if res.get('context', {}): - ctx = eval(res['context']) + user = self.pool.get('res.users').browse(cr, uid, uid, context=context) + ctx = eval(res['context'], {'user': user}) if ctx.get('res_id'): res.update({'res_id': ctx.get('res_id')}) return res