From 40050f1230474cca066c71f1f3cfaaa30dcd51c5 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Thu, 3 Dec 2009 13:31:10 +0100 Subject: [PATCH] [IMP] add new handler for addons configuration, corresponding menu item bzr revid: xmo@tinyerp.com-20091203123110-r1v2vycpe92bvvxc --- bin/addons/base/ir/ir.xml | 7 +++++++ bin/addons/base/ir/ir_actions.py | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/bin/addons/base/ir/ir.xml b/bin/addons/base/ir/ir.xml index ea42739..60d63b3 100644 --- a/bin/addons/base/ir/ir.xml +++ b/bin/addons/base/ir/ir.xml @@ -1411,5 +1411,12 @@ + + Start Configuration + + code + action = self.next(cr, uid) + + diff --git a/bin/addons/base/ir/ir_actions.py b/bin/addons/base/ir/ir_actions.py index dcdbf31..f8c6dfa 100644 --- a/bin/addons/base/ir/ir_actions.py +++ b/bin/addons/base/ir/ir_actions.py @@ -812,5 +812,42 @@ class ir_actions_configuration_wizard(osv.osv_memory): return self.button_next(cr, uid, ids, context) ir_actions_configuration_wizard() +class ir_actions_configurator(osv.osv_memory): + _name = 'ir.actions.configurator' + logger = netsvc.Logger() + def next_action(self, cr, uid, context=None): + todos = self.pool.get('ir.actions.todo') + self.logger.notifyChannel('actions', netsvc.LOG_INFO, + 'getting next %s' % todos) + active_todos = todos.search(cr, uid, + [('type','=','configure'), + ('state', '=', 'open'), + ('active','=',True)], + limit=1, context=None) + if active_todos: + return todos.browse(cr, uid, active_todos[0], context=None) + return None + + def next(self, cr, uid): + self.logger.notifyChannel('actions', netsvc.LOG_INFO, + 'getting next operation') + next = self.next_action(cr, uid) + self.logger.notifyChannel('actions', netsvc.LOG_INFO, + 'next action is %s' % next) + if next: + self.pool.get('ir.actions.todo').write(cr, uid, next.id, { + 'state':'done', + }, context=None) + action = next.action_id + return { + 'view_mode': action.view_mode, + 'view_type': action.view_type, + 'view_id': action.view_id and [action.view_id.id] or False, + 'res_model': action.res_model, + 'type': action.type, + 'target': action.target, + } + return {'type': 'ir.actions.act_window_close'} +ir_actions_configurator() # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: -- 1.7.10.4