[FIX] OPW 578548: res.config: correctly get previous config wizard, not always the...
authorXavier ALT <xal@openerp.com>
Mon, 27 Aug 2012 18:27:08 +0000 (20:27 +0200)
committerXavier ALT <xal@openerp.com>
Mon, 27 Aug 2012 18:27:08 +0000 (20:27 +0200)
bzr revid: xal@openerp.com-20120827182708-bb4vqtg45oomwh90

bin/addons/base/ir/ir_actions.py
bin/addons/base/res/res_config.py

index 7a07ca4..81b2c19 100644 (file)
@@ -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):
index 3f8c6f2..37b4309 100644 (file)
@@ -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')