[IMP] account.config.settings: improve layout of form, and make 'More Chart Templates' go to localization modules

bzr revid: rco@openerp.com-20120402085158-rfd93da15r71l7wk
This commit is contained in:
Raphael Collet 2012-04-02 10:51:58 +02:00
parent 012a96248e
commit 66ff113077
4 changed files with 41 additions and 37 deletions

View File

@ -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:

View File

@ -2,6 +2,14 @@
<openerp>
<data>
<record id="open_account_charts_modules" model="ir.actions.act_window">
<field name="name">Chart Templates</field>
<field name="res_model">ir.module.module</field>
<field name="view_mode">kanban,tree,form</field>
<field name="context" eval="{'search_default_category_id': ref('base.module_category_localization_account_charts')}"/>
<field name="search_view_id" ref="base.view_module_filter"/>
</record>
<record id="view_account_config_settings" model="ir.ui.view">
<field name="name">account settings</field>
<field name="model">account.config.settings</field>
@ -17,8 +25,8 @@
<group string="No Chart of Accounts exists for this Company" colspan="4" attrs="{'invisible': ['|', ('expects_chart_of_accounts','=',False), ('has_chart_of_accounts','=',True)]}">
<label string="Please select a chart template to install a chart of accounts." colspan="4"/>
<field name="chart_template_id" widget="selection" on_change="onchange_chart_template_id(chart_template_id)" domain="[('visible','=', True)]"/>
<button string="Other Chart Templates" icon="gtk-jump-to"
name="%(action_account_configuration_installer)d" type="action" context="{'default_company_id': company_id}"/>
<button string="Install More Chart Templates" icon="gtk-go-forward"
name="%(open_account_charts_modules)d" type="action"/>
<field name ="code_digits" groups="account.group_account_user"/>
<field name ="seq_journal" groups="base.group_extended"/>
<newline/>
@ -88,20 +96,17 @@
<separator string="Electronic Payments" colspan="4"/>
<field name="paypal_account"/>
</group>
<group colspan="2">
<separator string="Bank &amp; Cash" colspan="4"/>
<group colspan="2" col="2">
<separator string="Bank &amp; Cash" colspan="2"/>
<label string="Configure Bank Accounts :"/>
<button name="%(action_bank_tree)d" string="Configure Bank Accounts" icon="gtk-go-forward" type="action"/>
<field name="company_footer"/>
<newline/>
<label string="Setup your bank accounts: "/>
<button name="%(action_bank_tree)d" string="My Bank Accounts" icon="gtk-jump-to" type="action"/>
<newline/>
<field name="module_account_check_writing"/>
</group>
<group colspan="2">
<separator string="Analytic Accounting" colspan="4"/>
<group name="analytic_accounting" colspan="4"/>
<group colspan="2" col="2">
<separator string="Analytic Accounting" colspan="2"/>
<group name="analytic_accounting" colspan="2"/>
<field name="module_account_analytic_plans"/>
<newline/>
<field name="module_account_analytic_default"/>
</group>
</form>

View File

@ -47,7 +47,6 @@
<field name="arch" type="xml">
<group name="analytic_accounting" position="after">
<field name="group_analytic_account_for_purchases"/>
<newline/>
</group>
</field>
</record>

View File

@ -53,7 +53,6 @@
<field name="arch" type="xml">
<group name="analytic_accounting" position="after">
<field name="group_analytic_account_for_sales"/>
<newline/>
</group>
</field>
</record>