From bc1abffa51ad818e5fdb102199185184e55d5ff7 Mon Sep 17 00:00:00 2001 From: Xavier ALT Date: Mon, 27 Aug 2012 20:27:08 +0200 Subject: [PATCH] [FIX] OPW 578548: res.config: correctly get previous config wizard, not always the 1st non-done bzr revid: xal@openerp.com-20120827182708-bb4vqtg45oomwh90 --- bin/addons/base/ir/ir_actions.py | 2 +- bin/addons/base/res/res_config.py | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/bin/addons/base/ir/ir_actions.py b/bin/addons/base/ir/ir_actions.py index 7a07ca4..81b2c19 100644 --- a/bin/addons/base/ir/ir_actions.py +++ b/bin/addons/base/ir/ir_actions.py @@ -812,7 +812,7 @@ class ir_actions_todo(osv.osv): wizard_id = ids and ids[0] or False wizard = self.browse(cr, uid, wizard_id, context=context) res = self.pool.get('ir.actions.act_window').read(cr, uid, wizard.action_id.id, ['name', 'view_type', 'view_mode', 'res_model', 'context', 'views', 'type'], context=context) - res.update({'target':'new', 'nodestroy': True}) + res.update(target='new', nodestroy=True, context={'active_action_todo': wizard.id}) return res def action_open(self, cr, uid, ids, context=None): diff --git a/bin/addons/base/res/res_config.py b/bin/addons/base/res/res_config.py index 3f8c6f2..37b4309 100644 --- a/bin/addons/base/res/res_config.py +++ b/bin/addons/base/res/res_config.py @@ -89,7 +89,12 @@ class res_config_configurable(osv.osv_memory): # this is ultra brittle, but apart from storing the todo id # into the res.config view, I'm not sure how to get the # "previous" todo - previous_todo = self._next_action(cr, uid, context=context) + if context is None: + context = {} + if context.get('active_action_todo'): + previous_todo = self.pool.get('ir.actions.todo').browse(cr, uid, context['active_action_todo'], context=context) + else: + previous_todo = self._next_action(cr, uid, context=context) if not previous_todo: self.__logger.warn(_("Couldn't find previous ir.actions.todo")) return @@ -108,6 +113,7 @@ class res_config_configurable(osv.osv_memory): 'res_model': action.res_model, 'type': action.type, 'target': action.target, + 'context': {'active_action_todo': next.id}, } self.__logger.info('all configuration actions have been executed') -- 1.7.10.4