diff options
| author | Victor Feyens <vfe@odoo.com> | 2020-09-15 13:55:09 +0000 |
|---|---|---|
| committer | Victor Feyens <vfe@odoo.com> | 2020-10-22 13:10:54 +0000 |
| commit | 037012bc4e2935eb00a7f353529bb7ec55066733 (patch) | |
| tree | 3aa2efc3cfb905e9c15d382e9751cd15bdacc2db /addons/l10n_ch | |
| parent | 4ff9ff09193390d9b39b15046855f94a98ad8409 (diff) | |
[FIX] *: avoid direct references to countries
Ensure the code works fine even if countries are deleted.
Also consider "re"-created countries after deletion, by only considering
the country code, not the data reference.
This should reduce support requests related to deleted countries, and
ease the resolution of such problems by the users themselves.
TASK ID - 2368842
closes odoo/odoo#57837
Related: odoo/enterprise#13275
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
Diffstat (limited to 'addons/l10n_ch')
| -rw-r--r-- | addons/l10n_ch/__init__.py | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/addons/l10n_ch/__init__.py b/addons/l10n_ch/__init__.py index 15bb04a1202..45936de37a4 100644 --- a/addons/l10n_ch/__init__.py +++ b/addons/l10n_ch/__init__.py @@ -15,8 +15,7 @@ def init_settings(env): '''If the company is localized in Switzerland, activate the cash rounding by default. ''' # The cash rounding is activated by default only if the company is localized in Switzerland. - ch_country = env.ref('base.ch') - for company in env['res.company'].search([('partner_id.country_id', '=', ch_country.id)]): + for company in env['res.company'].search([('partner_id.country_id.code', '=', "CH")]): res_config_id = env['res.config.settings'].create({ 'company_id': company.id, 'group_cash_rounding': True |
