diff --git a/bin/addons/base/ir/ir.xml b/bin/addons/base/ir/ir.xml index 60d63b3464a..9d538a8a155 100644 --- a/bin/addons/base/ir/ir.xml +++ b/bin/addons/base/ir/ir.xml @@ -1413,7 +1413,7 @@ 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 5662422b4b3..dcdbf319cfc 100644 --- a/bin/addons/base/ir/ir_actions.py +++ b/bin/addons/base/ir/ir_actions.py @@ -812,45 +812,5 @@ 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, - } - self.logger.notifyChannel( - 'actions', netsvc.LOG_INFO, - 'all configuration actions have been executed') - return {'type': 'ir.actions.act_window_close'} -ir_actions_configurator() # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/bin/addons/base/res/__init__.py b/bin/addons/base/res/__init__.py index d8b335f590f..66278c82087 100644 --- a/bin/addons/base/res/__init__.py +++ b/bin/addons/base/res/__init__.py @@ -25,6 +25,7 @@ import country import bank import res_lang import partner +import res_config import res_currency import res_company import res_user diff --git a/bin/addons/base/res/res_config.py b/bin/addons/base/res/res_config.py new file mode 100644 index 00000000000..39c10ea72c4 --- /dev/null +++ b/bin/addons/base/res/res_config.py @@ -0,0 +1,69 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2009 Tiny SPRL (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from osv import osv +import netsvc + +class res_config_configurable(osv.osv_memory): + _name = 'res.configurable' + logger = netsvc.Logger() + + def _next_action(self, cr, uid): + 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, + } + self.logger.notifyChannel( + 'actions', netsvc.LOG_INFO, + 'all configuration actions have been executed') + return {'type': 'ir.actions.act_window_close'} + def next(self, cr, uid, *args, **kwargs): + return self._next(cr, uid) +res_config_configurable() + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/bin/addons/base/res/res_user.py b/bin/addons/base/res/res_user.py index 7fc985a70e5..943d6931c38 100644 --- a/bin/addons/base/res/res_user.py +++ b/bin/addons/base/res/res_user.py @@ -120,7 +120,6 @@ def _companies_get(self,cr, uid, context={}): class users(osv.osv): __admin_ids = {} _name = "res.users" - #_log_access = False def get_current_company(self, cr, uid): res=[] @@ -255,10 +254,10 @@ class users(osv.osv): return dataobj.browse(cr, uid, data_id, context).res_id def action_next(self,cr,uid,ids,context=None): - return self.pool.get('ir.actions.configurator').next(cr, uid) + return self.pool.get('res.configurable').next(cr, uid) def action_continue(self,cr,uid,ids,context={}): - return self.pool.get('ir.actions.configurator').next(cr, uid) + return self.pool.get('res.configurable').next(cr, uid) def action_new(self,cr,uid,ids,context={}): return { @@ -281,6 +280,7 @@ groups2() class res_config_view(osv.osv_memory): _name='res.config.view' + _inherit='res.configurable' _columns = { 'name':fields.char('Name', size=64), 'view': fields.selection([('simple','Simplified Interface'),('extended','Extended Interface')], 'View Mode', required=True ), @@ -290,7 +290,7 @@ class res_config_view(osv.osv_memory): } def action_cancel(self,cr,uid,ids,conect=None): - return self.pool.get('ir.actions.configurator').next(cr, uid) + return self.next(cr, uid) def action_set(self, cr, uid, ids, context=None): res=self.read(cr,uid,ids)[0] users_obj = self.pool.get('res.users') @@ -301,7 +301,7 @@ class res_config_view(osv.osv_memory): users_obj.write(cr, uid, [uid],{ 'groups_id':[(4,group_ids[0])] }, context=context) - return self.pool.get('ir.actions.configurator').next(cr, uid) + return self.next(cr, uid) res_config_view() # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: