From 6d956b2f1cd684f865edd3cb1dd766410db71ea6 Mon Sep 17 00:00:00 2001 From: Harshad Modi Date: Sat, 21 Jun 2008 09:54:30 +0000 Subject: [PATCH] imrovement on configuration wizard : * change name of all configuration wizard * imroovemnt on view * put view_id on user configuration wizard's action * put action on base setup and module upgrade wizard to call configuration wizard * make new configuration wizard for install extra module on service profile * make new configuration wizard for set extend group on admin user to set extendend view bzr revid: hmo@tinyerp.com-f68aa6f5d8985f63e4d63213179c9198c3f94168 --- addons/account/account.py | 2 + addons/account/account_view.xml | 10 +- addons/base_setup/base_setup_data.xml | 8 +- addons/base_setup/wizard/wizard_base_setup.py | 31 ++++- addons/profile_service/__init__.py | 2 +- addons/profile_service/__terp__.py | 16 +-- addons/profile_service/profile_service.py | 115 ++++++++++++++++++ addons/profile_service/profile_service.xml | 50 ++++++++ addons/sale/sale.py | 1 + addons/sale/sale_view.xml | 5 +- 10 files changed, 216 insertions(+), 24 deletions(-) create mode 100644 addons/profile_service/profile_service.py create mode 100644 addons/profile_service/profile_service.xml diff --git a/addons/account/account.py b/addons/account/account.py index 26a3e6583de..caf5eb74e99 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -1570,6 +1570,7 @@ class account_config_fiscalyear(osv.osv_memory): new_id=res_obj.create(cr, uid, vals, context=context) return { 'view_type': 'form', + "view_mode": 'form', 'res_model': 'ir.module.module.configuration.wizard', 'type': 'ir.actions.act_window', 'target':'new', @@ -1602,6 +1603,7 @@ class account_config_journal_bank_accounts(osv.osv_memory): res_obj.create(cr, uid, vals, context=context) return { 'view_type': 'form', + "view_mode": 'form', 'res_model': 'ir.module.module.configuration.wizard', 'type': 'ir.actions.act_window', 'target':'new', diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index 3df28d1305e..d20aa28bbb0 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -1492,7 +1492,7 @@ form
- + @@ -1511,6 +1511,7 @@ ir.actions.act_window account.config.fiscalyear form + form new @@ -1522,7 +1523,7 @@ form - + @@ -1541,6 +1542,7 @@ ir.actions.act_window account.config.journal.bank.account form + form new @@ -1548,14 +1550,14 @@ - account.config.fiscalyear + Define fiscal years open - account.config.journal.bank.account + Define journal for bank accounts open diff --git a/addons/base_setup/base_setup_data.xml b/addons/base_setup/base_setup_data.xml index 1f2327a64d1..a35c4a1e971 100644 --- a/addons/base_setup/base_setup_data.xml +++ b/addons/base_setup/base_setup_data.xml @@ -14,12 +14,6 @@ - + diff --git a/addons/base_setup/wizard/wizard_base_setup.py b/addons/base_setup/wizard/wizard_base_setup.py index 758d3556513..4977731d8cc 100644 --- a/addons/base_setup/wizard/wizard_base_setup.py +++ b/addons/base_setup/wizard/wizard_base_setup.py @@ -272,6 +272,25 @@ class wizard_base_setup(wizard.interface): return 'init' return 'charts' + def _config(self, cr, uid, data, context=None): + users_obj=pooler.get_pool(cr.dbname).get('res.users') + action_obj=pooler.get_pool(cr.dbname).get('ir.actions.act_window') + + ids=action_obj.search(cr, uid, [('name', '=', 'Menu')]) + menu=action_obj.browse(cr, uid, ids)[0] + + ids=users_obj.search(cr, uid, [('action_id', '=', 'Setup')]) + users_obj.write(cr, uid, ids, {'action_id': menu.id}) + ids=users_obj.search(cr, uid, [('menu_id', '=', 'Setup')]) + users_obj.write(cr, uid, ids, {'menu_id': menu.id}) + return { + 'view_type': 'form', + "view_mode": 'form', + 'res_model': 'ir.module.module.configuration.wizard', + 'type': 'ir.actions.act_window', + 'target':'new', + } + fields={ 'profile':{ 'string':'Profile', @@ -412,14 +431,22 @@ IBAN: BE74 1262 0121 6907 - SWIFT: CPDF BE71 - VAT: BE0477.472.701""", 'actions': [_update], 'result': {'type': 'form', 'arch': view_form_finish, 'fields': {}, 'state': [ - ('menu', 'Ok', 'gtk-ok', True) + ('menu', 'Ok', 'gtk-ok', True), + ('config', 'Start configuration', 'gtk-ok', True) ] } }, + 'config': { + 'result': { + 'type': 'action', + 'action': _config, + 'state': 'end', + }, + }, 'menu': { 'actions': [], 'result': {'type': 'action', 'action': _menu, 'state': 'end'} }, } -wizard_base_setup('base_setup.base_setup') +wizard_base_setup('base_setup.base_setup') \ No newline at end of file diff --git a/addons/profile_service/__init__.py b/addons/profile_service/__init__.py index 00fd7b7c4a1..11a0e4b5b37 100644 --- a/addons/profile_service/__init__.py +++ b/addons/profile_service/__init__.py @@ -26,4 +26,4 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # ############################################################################## - +import profile_service diff --git a/addons/profile_service/__terp__.py b/addons/profile_service/__terp__.py index 76715836d14..934c6405278 100644 --- a/addons/profile_service/__terp__.py +++ b/addons/profile_service/__terp__.py @@ -31,19 +31,19 @@ "author":"Tiny", "category":"Profile", "depends":[ - "hr", - "hr_timesheet", - "hr_timesheet_invoice", - "hr_timesheet_project", - "crm", + "hr", + "hr_timesheet", + "hr_timesheet_invoice", + "hr_timesheet_project", + "crm", "project", "board_project", "account_analytic_analysis" - ], - #"board_project", + ], + #"board_project", #"board_account"], "demo_xml":[], - "update_xml":[], + "update_xml":["profile_service.xml"], "active":False, "installable":True, } diff --git a/addons/profile_service/profile_service.py b/addons/profile_service/profile_service.py new file mode 100644 index 00000000000..2f78c583355 --- /dev/null +++ b/addons/profile_service/profile_service.py @@ -0,0 +1,115 @@ +############################################################################## +# +# Copyright (c) 2004-2008 Tiny SPRL (http://tiny.be) All Rights Reserved. +# +# $Id: __terp__.py 8595 2008-06-16 13:00:21Z stw $ +# +# WARNING: This program as such is intended to be used by professional +# programmers who take the whole responsability of assessing all potential +# consequences resulting from its eventual inadequacies and bugs +# End users who are looking for a ready-to-use solution with commercial +# garantees and support are strongly adviced to contract a Free Software +# Service Company +# +# This program is Free Software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +############################################################################### + +from osv import fields, osv +import pooler + +##class config_install_extra_modules(osv.osv_memory): +## _name='config.install_extra_modules' +## def _get_uninstall_modules(self,cr,uid,context=None): +## module_obj=self.pool.get('ir.module.module') +## line_obj=self.pool.get('config.install_extra_modules.line') +## uninstall_module_ids=module_obj.search(cr,uid,[('state', 'in', ['uninstalled', 'uninstallable'])]) +## res=[] +## for id in uninstall_module_ids: +## res.append(line_obj.create(cr,uid,{'module_id':id},context=None)) +## print res +## return res +## _columns = { +## 'name':fields.char('Name', size=64), +## 'module_ids':fields.one2many('config.install_extra_modules.line', 'config_id', 'Modules'), +## +## } +## _defaults={ +## 'module_ids':_get_uninstall_modules +## } +## def action_install(self, cr, uid, ids, context=None): +## res=self.read(cr,uid,ids)[0] +## mod_obj = self.pool.get('ir.module.module') +## line_obj=self.pool.get('config.install_extra_modules.line') +## if 'module_ids' in res: +## module_ids=res['module_ids'] +## lines=line_obj.read(cr,uid,module_ids) +## for line in lines: +## if 'install' in line and 'module_id' and line and line['install']: +## mod_obj.download(cr, uid, [line['module_id']], context=context) +## cr.commit() +## db, pool = pooler.restart_pool(cr.dbname, update_module=True) +## return { +## 'view_type': 'form', +## "view_mode": 'form', +## 'res_model': 'ir.module.module.configuration.wizard', +## 'type': 'ir.actions.act_window', +## 'target':'new', +## } +## +##config_install_extra_modules() +# +#class config_install_extra_modules_line(osv.osv_memory): +# _name='config.install_extra_modules.line' +# _columns = { +# 'name':fields.char('Name', size=64), +# 'install':fields.boolean('Install'), +# 'config_id': fields.many2one('config.install_extra_modules', 'Configuration Module Wizard'), +# 'module_id':fields.many2one('ir.module.module', 'Module',readonly=True,required=True), +# +# } +# +# +#config_install_extra_modules_line() + +class config_install_extra_modules(osv.osv_memory): + _name='config.install_extra_modules' + _columns = { + 'name':fields.char('Name', size=64), + 'timesheets_module':fields.boolean('Timesheets module'), + 'holidays_module':fields.boolean('Holidays module'), + + } + def action_install(self, cr, uid, ids, context=None): + res=self.read(cr,uid,ids)[0] + mod_obj = self.pool.get('ir.module.module') + if 'timesheets_module' in res and res['timesheets_module']: + ids = mod_obj.search(cr, uid, [('name', '=', 'hr_timesheet')]) + mod_obj.download(cr, uid, ids, context=context) + cr.commit() + db, pool = pooler.restart_pool(cr.dbname, update_module=True) + if 'hr_holidays_module' in res and res['hr_holidays_module']: + ids = mod_obj.search(cr, uid, [('name', '=', 'hr_holidays')]) + mod_obj.download(cr, uid, ids, context=context) + cr.commit() + db, pool = pooler.restart_pool(cr.dbname, update_module=True) + return { + 'view_type': 'form', + "view_mode": 'form', + 'res_model': 'ir.module.module.configuration.wizard', + 'type': 'ir.actions.act_window', + 'target':'new', + } + +config_install_extra_modules() \ No newline at end of file diff --git a/addons/profile_service/profile_service.xml b/addons/profile_service/profile_service.xml new file mode 100644 index 00000000000..d468fdafa4b --- /dev/null +++ b/addons/profile_service/profile_service.xml @@ -0,0 +1,50 @@ + + + + + Install extra modules + config.install_extra_modules + form + + + + + + + + +