[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
This commit is contained in:
@@ -8,9 +8,10 @@ class AccountChartTemplate(models.Model):
|
||||
@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_de.tag_de_asset_bs_B_III_2').id
|
||||
res.setdefault('tag_ids', [])
|
||||
res['tag_ids'].append((4, xml_id))
|
||||
if company.country_id.code == 'DE':
|
||||
xml_id = self.env.ref('l10n_de.tag_de_asset_bs_B_III_2').id
|
||||
res.setdefault('tag_ids', [])
|
||||
res['tag_ids'].append((4, xml_id))
|
||||
return res
|
||||
|
||||
# Write paperformat and report template used on company
|
||||
|
||||
@@ -44,7 +44,8 @@ class AccountChartTemplate(models.Model):
|
||||
@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_mx.account_tag_102_01').id
|
||||
res.setdefault('tag_ids', [])
|
||||
res['tag_ids'].append((4, xml_id))
|
||||
if company.country_id.code == 'MX':
|
||||
xml_id = self.env.ref('l10n_mx.account_tag_102_01').id
|
||||
res.setdefault('tag_ids', [])
|
||||
res['tag_ids'].append((4, xml_id))
|
||||
return res
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user