diff options
| author | Olivier Colson <oco@odoo.com> | 2018-11-26 09:51:07 +0000 |
|---|---|---|
| committer | Olivier Colson <oco@odoo.com> | 2018-11-26 13:17:10 +0000 |
| commit | db21ef75783af1c90cfa966130c976bc138b58c0 (patch) | |
| tree | 4b812c59340b2aeaed8fa4c961f018b21f92e194 /addons/l10n_nl | |
| parent | cb097e05ea7aa6e0931581fae395541160688f12 (diff) | |
[FIX] l10n_de, l10n_mx, l10n_nl: isolate account.tag creation by country
Before that, the specific account tags created in l10n modules were not only assigned when the company was in the right country.
closes odoo/odoo#29030
Diffstat (limited to 'addons/l10n_nl')
| -rw-r--r-- | addons/l10n_nl/models/account_chart_template.py | 14 | ||||
| -rw-r--r-- | addons/l10n_nl/models/account_journal.py | 11 |
2 files changed, 14 insertions, 11 deletions
diff --git a/addons/l10n_nl/models/account_chart_template.py b/addons/l10n_nl/models/account_chart_template.py index 886afdb59d4..483ce15650c 100644 --- a/addons/l10n_nl/models/account_chart_template.py +++ b/addons/l10n_nl/models/account_chart_template.py @@ -9,15 +9,17 @@ class AccountChartTemplate(models.Model): def load_for_current_company(self, sale_tax_rate, purchase_tax_rate): # Add tag to 999999 account res = super(AccountChartTemplate, self).load_for_current_company(sale_tax_rate, purchase_tax_rate) - account = self.env['account.account'].search([('code', '=', '999999'), ('company_id', '=', self.env.user.company_id.id)]) - if account: - account.tag_ids = [(4, self.env.ref('l10n_nl.account_tag_12').id)] + if self.env.user.company_id.country_id.code == 'NL': + account = self.env['account.account'].search([('code', '=', '999999'), ('company_id', '=', self.env.user.company_id.id)]) + if account: + account.tag_ids = [(4, self.env.ref('l10n_nl.account_tag_12').id)] return res @api.model def _prepare_transfer_account_for_direct_creation(self, name, company): res = super(AccountChartTemplate, self)._prepare_transfer_account_for_direct_creation(name, company) - xml_id = self.env.ref('l10n_nl.account_tag_25').id - res.setdefault('tag_ids', []) - res['tag_ids'].append((4, xml_id)) + if company.country_id.code == 'NL': + xml_id = self.env.ref('l10n_nl.account_tag_25').id + res.setdefault('tag_ids', []) + res['tag_ids'].append((4, xml_id)) return res diff --git a/addons/l10n_nl/models/account_journal.py b/addons/l10n_nl/models/account_journal.py index 0114aa0db18..987da59cd18 100644 --- a/addons/l10n_nl/models/account_journal.py +++ b/addons/l10n_nl/models/account_journal.py @@ -10,10 +10,11 @@ class AccountJournal(models.Model): def _prepare_liquidity_account(self, name, company, currency_id, type): account_vals = super(AccountJournal, self)._prepare_liquidity_account(name, company, currency_id, type) - # Ensure the newly liquidity accounts have the right account tag in order to be part - # of the Dutch financial reports. - tag_ids = account_vals.get('tag_ids', []) - tag_ids.append((4, self.env.ref('l10n_nl.account_tag_25').id)) - account_vals['tag_ids'] = tag_ids + if company.country_id.code == 'NL': + # Ensure the newly liquidity accounts have the right account tag in order to be part + # of the Dutch financial reports. + tag_ids = account_vals.get('tag_ids', []) + tag_ids.append((4, self.env.ref('l10n_nl.account_tag_25').id)) + account_vals['tag_ids'] = tag_ids return account_vals |
