diff options
| author | Ravi Gohil <rgo@odoo.com> | 2020-03-24 06:23:07 +0000 |
|---|---|---|
| committer | Ravi Gohil <rgo@odoo.com> | 2020-03-24 06:51:22 +0000 |
| commit | d2bd6d69d647777fffe51c22cbb324e6d27a950f (patch) | |
| tree | b93922ddda29752723c2f0c20cc3b43e0ebfafa2 | |
| parent | fd9b2590261e6caf4a8952d17db6e1ca06778140 (diff) | |
[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
| -rw-r--r-- | addons/account/__manifest__.py | 1 | ||||
| -rw-r--r-- | addons/account/models/company.py | 3 | ||||
| -rw-r--r-- | addons/account/models/res_config_settings.py | 3 | ||||
| -rw-r--r-- | addons/account/views/res_company_views.xml | 13 | ||||
| -rw-r--r-- | addons/account/views/res_config_settings_views.xml | 1 | ||||
| -rw-r--r-- | addons/account_check_printing/models/res_config_settings.py | 1 | ||||
| -rw-r--r-- | addons/account_check_printing/views/res_config_settings_views.xml | 1 |
7 files changed, 21 insertions, 2 deletions
diff --git a/addons/account/__manifest__.py b/addons/account/__manifest__.py index c636ac23fc6..fba849af309 100644 --- a/addons/account/__manifest__.py +++ b/addons/account/__manifest__.py @@ -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', diff --git a/addons/account/models/company.py b/addons/account/models/company.py index 49623dde125..c7289b0e2c2 100644 --- a/addons/account/models/company.py +++ b/addons/account/models/company.py @@ -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: diff --git a/addons/account/models/res_config_settings.py b/addons/account/models/res_config_settings.py index 6557f4b907f..3ea53a26ea5 100644 --- a/addons/account/models/res_config_settings.py +++ b/addons/account/models/res_config_settings.py @@ -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: diff --git a/addons/account/views/res_company_views.xml b/addons/account/views/res_company_views.xml new file mode 100644 index 00000000000..29d96cc7373 --- /dev/null +++ b/addons/account/views/res_company_views.xml @@ -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>
\ No newline at end of file diff --git a/addons/account/views/res_config_settings_views.xml b/addons/account/views/res_config_settings_views.xml index dc68739b79b..5b430b9c0d8 100644 --- a/addons/account/views/res_config_settings_views.xml +++ b/addons/account/views/res_config_settings_views.xml @@ -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"/> diff --git a/addons/account_check_printing/models/res_config_settings.py b/addons/account_check_printing/models/res_config_settings.py index 159498ac67e..2e7b9e2ea7f 100644 --- a/addons/account_check_printing/models/res_config_settings.py +++ b/addons/account_check_printing/models/res_config_settings.py @@ -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'.") diff --git a/addons/account_check_printing/views/res_config_settings_views.xml b/addons/account_check_printing/views/res_config_settings_views.xml index e3325ae3c84..969787a7621 100644 --- a/addons/account_check_printing/views/res_config_settings_views.xml +++ b/addons/account_check_printing/views/res_config_settings_views.xml @@ -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"/> |
