From 66ff113077bbb011846426b63a8cb354c8b8045b Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Mon, 2 Apr 2012 10:51:58 +0200 Subject: [PATCH] [IMP] account.config.settings: improve layout of form, and make 'More Chart Templates' go to localization modules bzr revid: rco@openerp.com-20120402085158-rfd93da15r71l7wk --- addons/account/res_config.py | 47 +++++++++++++++-------------- addons/account/res_config_view.xml | 29 ++++++++++-------- addons/purchase/res_config_view.xml | 1 - addons/sale/res_config_view.xml | 1 - 4 files changed, 41 insertions(+), 37 deletions(-) diff --git a/addons/account/res_config.py b/addons/account/res_config.py index d3f52c590ab..b053b438894 100644 --- a/addons/account/res_config.py +++ b/addons/account/res_config.py @@ -44,7 +44,7 @@ class account_config_settings(osv.osv_memory): 'paypal_account': fields.related('company_id', 'paypal_account', type='char', size=128, string='Paypal account', help="Paypal username (usually email) for receiving online payments."), 'company_footer': fields.related('company_id', 'rml_footer2', type='char', size=250, readonly=True, - string='Footer of reports', help="Footer of reports based on your bank accounts."), + string='Bank Accounts on Reports', help="Bank accounts as printed on footer of reports."), 'has_chart_of_accounts': fields.boolean('Company has a chart of accounts'), 'chart_template_id': fields.many2one('account.chart.template', 'Chart Template', domain="[('visible','=', True)]"), @@ -247,27 +247,28 @@ class account_config_settings(osv.osv_memory): def set_fiscalyear(self, cr, uid, ids, context=None): """ create a fiscal year for the given company (if necessary) """ config = self.browse(cr, uid, ids[0], context) - fiscalyear = self.pool.get('account.fiscalyear') - fiscalyear_count = fiscalyear.search_count(cr, uid, - [('date_start', '<=', config.date_start), ('date_stop', '>=', config.date_stop), - ('company_id', '=', config.company_id.id)], - context=context) - if not fiscalyear_count: - name = code = config.date_start[:4] - if int(name) != int(config.date_stop[:4]): - name = config.date_start[:4] +'-'+ config.date_stop[:4] - code = config.date_start[2:4] +'-'+ config.date_stop[2:4] - vals = { - 'name': name, - 'code': code, - 'date_start': config.date_start, - 'date_stop': config.date_stop, - 'company_id': config.company_id.id, - } - fiscalyear_id = fiscalyear.create(cr, uid, vals, context=context) - if config.period == 'month': - fiscalyear.create_period(cr, uid, [fiscalyear_id]) - elif config.period == '3months': - fiscalyear.create_period3(cr, uid, [fiscalyear_id]) + if config.has_chart_of_accounts or config.chart_template_id: + fiscalyear = self.pool.get('account.fiscalyear') + fiscalyear_count = fiscalyear.search_count(cr, uid, + [('date_start', '<=', config.date_start), ('date_stop', '>=', config.date_stop), + ('company_id', '=', config.company_id.id)], + context=context) + if not fiscalyear_count: + name = code = config.date_start[:4] + if int(name) != int(config.date_stop[:4]): + name = config.date_start[:4] +'-'+ config.date_stop[:4] + code = config.date_start[2:4] +'-'+ config.date_stop[2:4] + vals = { + 'name': name, + 'code': code, + 'date_start': config.date_start, + 'date_stop': config.date_stop, + 'company_id': config.company_id.id, + } + fiscalyear_id = fiscalyear.create(cr, uid, vals, context=context) + if config.period == 'month': + fiscalyear.create_period(cr, uid, [fiscalyear_id]) + elif config.period == '3months': + fiscalyear.create_period3(cr, uid, [fiscalyear_id]) # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account/res_config_view.xml b/addons/account/res_config_view.xml index 672963cd676..182e689c163 100644 --- a/addons/account/res_config_view.xml +++ b/addons/account/res_config_view.xml @@ -2,6 +2,14 @@ + + Chart Templates + ir.module.module + kanban,tree,form + + + + account settings account.config.settings @@ -17,8 +25,8 @@