From d2bd6d69d647777fffe51c22cbb324e6d27a950f Mon Sep 17 00:00:00 2001 From: Ravi Gohil Date: Tue, 24 Mar 2020 06:23:07 +0000 Subject: [PATCH] [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 --- addons/account/__manifest__.py | 1 + addons/account/models/company.py | 3 +++ addons/account/models/res_config_settings.py | 3 +++ addons/account/views/res_company_views.xml | 13 +++++++++++++ addons/account/views/res_config_settings_views.xml | 1 + .../models/res_config_settings.py | 1 - .../views/res_config_settings_views.xml | 1 - 7 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 addons/account/views/res_company_views.xml 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 @@ + + + + res.company.form.inherit.account + res.company + + + + + + + + \ 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 @@ +
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 @@
-