[IMP]: base: Improvement in configuration wizard action, added view
[odoo/odoo.git] / bin / addons / base / module / wizard / base_module_configuration.py
1 # -*- coding: utf-8 -*-
2 ##############################################################################
3 #
4 #    OpenERP, Open Source Management Solution
5 #    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
6 #
7 #    This program is free software: you can redistribute it and/or modify
8 #    it under the terms of the GNU Affero General Public License as
9 #    published by the Free Software Foundation, either version 3 of the
10 #    License, or (at your option) any later version.
11 #
12 #    This program is distributed in the hope that it will be useful,
13 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
14 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 #    GNU Affero General Public License for more details.
16 #
17 #    You should have received a copy of the GNU Affero General Public License
18 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
19 #
20 ##############################################################################
21
22 from osv import osv
23 from tools.translate import _
24
25 class base_module_configuration(osv.osv_memory):
26
27     _name = "base.module.configuration"
28
29     def start(self, cr, uid, ids, context=None):
30         todo_ids = self.pool.get('ir.actions.todo').search(cr, uid, ['|', ('state', '=', 'open'), ('restart', '=', 'always')])
31         if not todo_ids:
32             # When there is no wizard todo it will display message
33             data_obj = self.pool.get('ir.model.data')
34             result = data_obj._get_id(cr, uid, 'base', 'view_base_module_configuration_form')
35             view_id = data_obj.browse(cr, uid, result).res_id
36             value = {
37                     'name': _('System Configuration done'), 
38                     'view_type': 'form', 
39                     'view_mode': 'form', 
40                     'res_model': 'base.module.configuration', 
41                     'view_id': view_id, 
42                     'type': 'ir.actions.act_window', 
43                 }
44             return value
45         # Run the config wizards
46         config_pool = self.pool.get('res.config')
47         return config_pool.start(cr, uid, ids, context=context)
48
49 base_module_configuration()
50
51 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: