diff --git a/addons/account/account.py b/addons/account/account.py index 29ea824f171..ed460c041c7 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -1748,15 +1748,6 @@ class account_config_wizard(osv.osv_memory): _name = 'account.config.wizard' _inherit = 'res.config' - def _get_charts(self, cr, uid, context): - module_obj=self.pool.get('ir.module.module') - ids=module_obj.search(cr, uid, [('category_id', '=', 'Account Charts'), - ('state', '<>', 'installed')]) - res=[(m.id, m.shortdesc) for m in module_obj.browse(cr, uid, ids)] - res.append((-1, 'None')) - res.sort(key=lambda x: x[1]) - return res - _columns = { 'name':fields.char( 'Name', required=True, size=64, @@ -1768,7 +1759,6 @@ class account_config_wizard(osv.osv_memory): 'date2': fields.date('End Date', required=True), 'period':fields.selection([('month','Month'), ('3months','3 Months')], 'Periods', required=True), - 'charts' : fields.selection(_get_charts, 'Charts of Account',required=True) } _defaults = { 'code': lambda *a: time.strftime('%Y'), @@ -1777,14 +1767,6 @@ class account_config_wizard(osv.osv_memory): 'date2': lambda *a: time.strftime('%Y-12-31'), 'period':lambda *a:'month', } - def install_account_chart(self, cr, uid, ids, context=None): - for res in self.read(cr,uid,ids): - chart_id = res['charts'] - if chart_id > 0: - mod_obj = self.pool.get('ir.module.module') - mod_obj.button_install(cr, uid, [chart_id], context=context) - cr.commit() - db, pool = pooler.restart_pool(cr.dbname, update_module=True) def execute(self, cr, uid, ids, context=None): for res in self.read(cr,uid,ids): @@ -1804,7 +1786,6 @@ class account_config_wizard(osv.osv_memory): res_obj.create_period(cr,uid,[new_id]) elif res['period']=='3months': res_obj.create_period3(cr,uid,[new_id]) - self.install_account_chart(cr,uid,ids) account_config_wizard() diff --git a/addons/account/account_installer.xml b/addons/account/account_installer.xml index 4a1a1274e9f..4c9742fd127 100644 --- a/addons/account/account_installer.xml +++ b/addons/account/account_installer.xml @@ -4,43 +4,31 @@ account.installer.view account.installer form - + -
- Accounting Modules Installation -
+
+ Accounting Modules Installation +
- - - - - - - - - Install Modules + + Configure Your Accounting System + + + You can enhance OpenERP's basic accounting support with a few additional OpenERP applications + + + + + + + + + +
@@ -57,7 +45,7 @@ - 1 + 3 diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index 709009f8481..4ab7e6329a9 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -1451,9 +1451,9 @@ -
- Account Configure -
+
+ Account Configure +
@@ -1461,8 +1461,6 @@ - -
@@ -1734,16 +1732,14 @@ -
- Generate Chart of Accounts from a Chart Template -
+
+ Generate Chart of Accounts from a Chart Template +
-
diff --git a/addons/account/installer.py b/addons/account/installer.py index 2e7ebb5ed44..35a09406891 100644 --- a/addons/account/installer.py +++ b/addons/account/installer.py @@ -18,21 +18,61 @@ # along with this program. If not, see . # ############################################################################## +from operator import itemgetter + from osv import fields, osv +import netsvc class account_installer(osv.osv_memory): _name = 'account.installer' _inherit = 'res.config.installer' + def _get_charts(self, cr, uid, context=None): + modules = self.pool.get('ir.module.module') + ids = modules.search(cr, uid, [('category_id','=','Account Charts')]) + return list( + sorted(((m.name, m.shortdesc) + for m in modules.browse(cr, uid, ids)), + key=itemgetter(1))) + _columns = { # Accounting - 'account_analytic_default':fields.boolean('Analytic Accounting'), - 'account_analytic_plans':fields.boolean('Multiple Analytic Plans'), - 'account_payment':fields.boolean('Suppliers Payment Management'), - 'account_followup':fields.boolean('Followups Management'), - 'account_asset':fields.boolean('Assets Management') + 'charts':fields.selection(_get_charts, 'Chart of Accounts', + required=True, + help="Installs localized accounting charts to match as closely as " + "possible the accounting needs of your company based on your " + "country."), + 'account_analytic_default':fields.boolean('Analytic Accounting', + help="Automatically selects analytic accounts based on various " + "criteria."), + 'account_analytic_plans':fields.boolean('Multiple Analytic Plans', + help="Allows invoice lines to impact multiple analytic accounts " + "simultaneously."), + 'account_payment':fields.boolean('Suppliers Payment Management', + help="Streamlines invoice payment and creates hooks to plug " + "automated payment systems in."), + 'account_followup':fields.boolean('Followups Management', + help="Helps you generate reminder letters for unpaid invoices, " + "including multiple levels of reminding and customized " + "per-partner policies."), + 'account_asset':fields.boolean('Assets Management', + help="Enables asset management in the accounting application, " + "including asset categories and usage periods.") } _defaults = { 'account_analytic_default':True, } + + def modules_to_install(self, cr, uid, ids, context=None): + modules = super(account_installer, self).modules_to_install( + cr, uid, ids, context=context) + + chart = self.read(cr, uid, ids, ['charts'], + context=context)[0]['charts'] + self.logger.notifyChannel( + 'installer', netsvc.LOG_DEBUG, + 'Installing chart of accounts %s'%chart) + return modules | set([chart]) + + account_installer() diff --git a/addons/account/security/ir.model.access.csv b/addons/account/security/ir.model.access.csv index bb7ffbae946..e4806d436d0 100644 --- a/addons/account/security/ir.model.access.csv +++ b/addons/account/security/ir.model.access.csv @@ -87,6 +87,3 @@ "access_account_fiscal_position_account_template","account.fiscal.position.account.template","model_account_fiscal_position_account_template","account.group_account_manager",1,1,1,1 "access_account_sequence_fiscal_year","account.sequence.fiscalyear","model_account_sequence_fiscalyear","account.group_account_user",1,1,1,1 "access_account_sequence_fiscal_year_user","account.sequence.fiscalyear user","model_account_sequence_fiscalyear","base.group_user",1,0,0,0 -"access_wizard_company_setup_manager","wizard.company.setup manager","model_wizard_company_setup","account.group_account_manager",1,1,1,1 -"access_wizard_company_setup","wizard.company.setup","model_wizard_company_setup","account.group_account_user",1,0,0,0 -"access_wizard_company_setup_user","wizard.company.setup user","model_wizard_company_setup","base.group_user",1,0,0,0 diff --git a/addons/base_setup/__init__.py b/addons/base_setup/__init__.py index 2e2da2196e5..22e81a488b0 100644 --- a/addons/base_setup/__init__.py +++ b/addons/base_setup/__init__.py @@ -20,7 +20,62 @@ ############################################################################## import installer +import todo import wizard +from osv import osv +import netsvc + +class base_setup_config_choice(osv.osv_memory): + """ + """ + _name = 'base.setup.config' + logger = netsvc.Logger() + + def set_default_menu(self, cr, uid, menu, context=None): + user = self.pool.get('res.users')\ + .browse(cr, uid, uid, context=context) + + user.write({'action_id': menu.id, + 'menu_id': menu.id}) + + 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,\ + 'A given user should only have one menu item' + 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, + 'res_users': menu.res_model, + 'src_model': menu.src_model, + 'view_type': menu.view_type, + 'view_mode': menu.view_mode, + 'views': menu.views, + } + 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() + + # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/base_setup/__terp__.py b/addons/base_setup/__terp__.py index 6f7f4337740..c6dd64d7bcc 100644 --- a/addons/base_setup/__terp__.py +++ b/addons/base_setup/__terp__.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- ############################################################################## -# +# # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (). # @@ -15,7 +15,7 @@ # 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 . +# along with this program. If not, see . # ############################################################################## @@ -42,8 +42,8 @@ 'depends': ['base'], 'init_xml': ['base_setup_data.xml'], 'update_xml': ['security/ir.model.access.csv', - 'base_setup_wizard.xml', - 'base_setup_installer.xml'], + 'base_setup_installer.xml', + 'base_setup_todo.xml',], 'demo_xml': ['base_setup_demo.xml'], 'installable': True, 'active': True, diff --git a/addons/base_setup/base_setup_data.xml b/addons/base_setup/base_setup_data.xml index c715dbb6992..a28c7744158 100644 --- a/addons/base_setup/base_setup_data.xml +++ b/addons/base_setup/base_setup_data.xml @@ -1,17 +1,41 @@ - - - - Setup - ir.actions.wizard - base_setup.base_setup - - - - - - - - + + + Setup + base.setup.config + form + +
+ + + + + + +