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_se | |
| 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_se')
| -rw-r--r-- | addons/l10n_se/models/res_company.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/addons/l10n_se/models/res_company.py b/addons/l10n_se/models/res_company.py index 412412e217a..af2ca1872b8 100644 --- a/addons/l10n_se/models/res_company.py +++ b/addons/l10n_se/models/res_company.py @@ -13,7 +13,7 @@ class ResCompany(models.Model): @api.depends('vat') def _compute_org_number(self): for company in self: - if company.country_id == self.env.ref('base.se') and company.vat: + if company.country_id.code == "SE" and company.vat: org_number = re.sub(r'\D', '', company.vat)[:-2] org_number = org_number[:6] + '-' + org_number[6:] |
