2009-10-13 05:58:37 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
2006-12-07 13:41:40 +00:00
|
|
|
##############################################################################
|
2010-04-27 10:17:24 +00:00
|
|
|
#
|
2009-10-14 11:15:34 +00:00
|
|
|
# OpenERP, Open Source Management Solution
|
2010-01-12 09:18:39 +00:00
|
|
|
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
2008-06-16 11:00:21 +00:00
|
|
|
#
|
2008-11-03 19:18:56 +00:00
|
|
|
# This program is free software: you can redistribute it and/or modify
|
2009-10-14 11:15:34 +00:00
|
|
|
# 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.
|
2006-12-07 13:41:40 +00:00
|
|
|
#
|
2008-11-03 19:18:56 +00:00
|
|
|
# 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
|
2009-10-14 11:15:34 +00:00
|
|
|
# GNU Affero General Public License for more details.
|
2006-12-07 13:41:40 +00:00
|
|
|
#
|
2009-10-14 11:15:34 +00:00
|
|
|
# You should have received a copy of the GNU Affero General Public License
|
2010-04-27 10:17:24 +00:00
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2006-12-07 13:41:40 +00:00
|
|
|
#
|
|
|
|
##############################################################################
|
|
|
|
|
2010-01-06 13:34:05 +00:00
|
|
|
import installer
|
2010-01-21 12:13:11 +00:00
|
|
|
import todo
|
2010-05-05 04:53:49 +00:00
|
|
|
import gtk_contact_form
|
2006-12-07 13:41:40 +00:00
|
|
|
import wizard
|
2008-07-23 14:41:47 +00:00
|
|
|
|
2010-04-27 10:17:24 +00:00
|
|
|
from osv import fields, osv
|
2010-01-22 10:14:27 +00:00
|
|
|
import netsvc
|
2010-04-27 10:17:24 +00:00
|
|
|
from tools.translate import _
|
2010-01-22 10:14:27 +00:00
|
|
|
|
|
|
|
class base_setup_config_choice(osv.osv_memory):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
_name = 'base.setup.config'
|
|
|
|
logger = netsvc.Logger()
|
|
|
|
|
2010-04-27 10:17:24 +00:00
|
|
|
def get_users(self, cr, uid, context={}):
|
|
|
|
user_obj = self.pool.get('res.users')
|
|
|
|
user_ids = user_obj.search(cr, uid, [])
|
|
|
|
users = user_obj.browse(cr, uid, user_ids)
|
|
|
|
user_str = '\n'.join(map(lambda x: ' - %s: %s / %s' % (x.name, x.login, x.password), users))
|
|
|
|
return _('The following users have been installed on your database: \n')+ user_str
|
|
|
|
|
|
|
|
_columns = {
|
2010-04-27 13:10:07 +00:00
|
|
|
'installed_users':fields.text('Installed Users', readonly=True)
|
2010-04-27 10:17:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
_defaults = {
|
|
|
|
'installed_users':get_users
|
|
|
|
}
|
|
|
|
|
2010-01-22 10:14:27 +00:00
|
|
|
def set_default_menu(self, cr, uid, menu, context=None):
|
2010-01-26 19:30:48 +00:00
|
|
|
user = self.pool.get('res.users')\
|
|
|
|
.browse(cr, uid, uid, context=context)
|
|
|
|
|
|
|
|
user.write({'action_id': menu.id,
|
|
|
|
'menu_id': menu.id})
|
2010-01-22 10:14:27 +00:00
|
|
|
|
|
|
|
def get_default_menu(self, cr, uid, context=None):
|
|
|
|
actions = self.pool.get('ir.actions.act_window')
|
|
|
|
|
|
|
|
current_menu_id = actions.search(cr, uid, [('name','=','Menu')],
|
|
|
|
context=context)
|
|
|
|
assert len(current_menu_id) == 1,\
|
2010-01-26 19:30:48 +00:00
|
|
|
'A given user should only have one menu item'
|
2010-01-22 10:14:27 +00:00
|
|
|
return actions.browse(cr, uid, current_menu_id[0], context=context)
|
|
|
|
|
|
|
|
def menu(self, cr, uid, ids, context=None):
|
|
|
|
menu = self.get_default_menu(cr, uid, context=context)
|
|
|
|
self.set_default_menu(cr, uid, menu, context=context)
|
|
|
|
|
|
|
|
if menu.view_id.id:
|
|
|
|
view_id = (menu.view_id.id, menu.view_id.name)
|
|
|
|
else:
|
|
|
|
view_id = False
|
|
|
|
|
|
|
|
return {
|
|
|
|
'name': menu.name,
|
|
|
|
'type': menu.type,
|
|
|
|
'view_id': view_id,
|
|
|
|
'domain': menu.domain,
|
2010-02-26 09:25:25 +00:00
|
|
|
'res_model': menu.res_model,
|
2010-01-22 10:14:27 +00:00
|
|
|
'src_model': menu.src_model,
|
|
|
|
'view_type': menu.view_type,
|
|
|
|
'view_mode': menu.view_mode,
|
|
|
|
'views': menu.views,
|
|
|
|
}
|
2010-02-26 09:25:25 +00:00
|
|
|
|
2010-01-22 10:14:27 +00:00
|
|
|
def config(self, cr, uid, ids, context=None):
|
|
|
|
menu = self.get_default_menu(cr, uid, context=context)
|
|
|
|
self.set_default_menu(cr, uid, menu, context=context)
|
|
|
|
|
|
|
|
return self.pool.get('res.config').next(cr, uid, [], context=context)
|
|
|
|
|
|
|
|
base_setup_config_choice()
|
|
|
|
|
|
|
|
|
2008-07-23 14:41:47 +00:00
|
|
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
|
|
|