[IMP] account{_check_printing}: Added 'Country Code' field

Many localization modules adds field 'l10n_xx_country_code' on
Company/Settings views with the purpose of using it to hide that
particular localization's fields from other country's users.
So, it is better to add a common field in account module so that
other localization can use that field instead of adding a new one
where ever it is required.

Also, one such field was already added from account_check_printing
module, so we removed it from there as it is not needed anymore.

Task: 2049977
Closes: #35755
Related: odoo/enterprise#5158
This commit is contained in:
Ravi Gohil
2020-03-24 06:51:22 +00:00
parent fd9b259026
commit d2bd6d69d6
7 changed files with 21 additions and 2 deletions
+1
View File
@@ -38,6 +38,7 @@ You could use this simplified accounting in case you work with an (external) acc
'data/mail_template_data.xml',
'wizard/account_validate_move_view.xml',
'views/account_end_fy.xml',
'views/res_company_views.xml',
'views/product_view.xml',
'views/account_analytic_view.xml',
'views/account_tip_data.xml',
+3
View File
@@ -107,6 +107,9 @@ class ResCompany(models.Model):
domain="[('internal_group', '=', 'asset'), ('internal_type', 'not in', ('receivable', 'payable')), ('reconcile', '=', True), ('company_id', '=', id)]")
accrual_default_journal_id = fields.Many2one('account.journal', help="Journal used by default for moving the period of an entry", domain="[('type', '=', 'general')]")
# Technical field to hide country specific fields in company form view
country_code = fields.Char(related='country_id.code')
@api.constrains('account_opening_move_id', 'fiscalyear_last_day', 'fiscalyear_last_month')
def _check_fiscalyear_last_day(self):
# if the user explicitly chooses the 29th of February we allow it:
@@ -89,6 +89,9 @@ class ResConfigSettings(models.TransientModel):
string='Default Terms & Conditions',
config_parameter='account.use_invoice_terms')
# Technical field to hide country specific fields from accounting configuration
country_code = fields.Char(related='company_id.country_id.code', readonly=True)
def set_values(self):
super(ResConfigSettings, self).set_values()
if self.group_multi_currency:
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_company_form" model="ir.ui.view">
<field name="name">res.company.form.inherit.account</field>
<field name="model">res.company</field>
<field name="inherit_id" ref="base.view_company_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='country_id']" position="after">
<field name="country_code" invisible="1"/>
</xpath>
</field>
</record>
</odoo>
@@ -19,6 +19,7 @@
<field name="inherit_id" ref="base.res_config_settings_view_form"/>
<field name="arch" type="xml">
<xpath expr="//div[hasclass('settings')]" position="inside">
<field name="country_code" invisible="1"/>
<div class="app_settings_block" data-string="Invoicing" string="Invoicing" data-key="account" groups="account.group_account_manager">
<field name="has_chart_of_accounts" invisible="1"/>
<field name="has_accounting_entries" invisible="1"/>
@@ -7,7 +7,6 @@ from odoo import fields, models
class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'
country_code = fields.Char(string="Company Country code", related='company_id.country_id.code', readonly=True)
account_check_printing_layout = fields.Selection(related='company_id.account_check_printing_layout', string="Check Layout", readonly=False,
help="Select the format corresponding to the check paper you will be printing your checks on.\n"
"In order to disable the printing feature, select 'None'.")
@@ -23,7 +23,6 @@
<label for="account_check_printing_margin_left" class="col-lg-4 o_light_label"/>
<field name="account_check_printing_margin_left"/>
</div>
<field name="country_code" invisible="1" />
<div class="row" attrs="{'invisible': [('country_code', '!=', 'CA')]}">
<label for="account_check_printing_margin_right" class="col-lg-4 o_light_label"/>
<field name="account_check_printing_margin_right"/>