[FIX] l10n_eu_service: don't duplicate OSS taxes on refresh of an existing rate
To reproduce: 1) Install an European CoA and make sure the OSS mapping for its taxes has been generated (either installing l10n_eu_service before, or clikcing the "refresh tax mapping" button, in the settings) 2) Create a new tax with the same rate as one of your original taxes 3) Click on "refresh tax mapping" ===> Instead of reusing the OSS tax mapped with the other tax having the same rate, a new tax with the same name has been created. X-original-commit: 6f6386ed0374cea143541add69c269f44b098050
This commit is contained in:
@@ -33,7 +33,6 @@ class Company(models.Model):
|
||||
('tax_group_id', 'not in', oss_tax_groups.mapped('res_id'))])
|
||||
for country in eu_countries - company.account_fiscal_country_id:
|
||||
mapping = []
|
||||
foreign_taxes = {}
|
||||
fpos = self.env['account.fiscal.position'].search([
|
||||
('country_id', '=', country.id),
|
||||
('company_id', '=', company.id),
|
||||
@@ -46,6 +45,9 @@ class Company(models.Model):
|
||||
'company_id': company.id,
|
||||
'auto_apply': True,
|
||||
})
|
||||
|
||||
foreign_taxes = {tax.amount: tax for tax in fpos.tax_ids.tax_dest_id if tax.amount_type == 'percent'}
|
||||
|
||||
for domestic_tax in taxes:
|
||||
tax_amount = EU_TAX_MAP.get((company.account_fiscal_country_id.code, domestic_tax.amount, country.code), False)
|
||||
if tax_amount and domestic_tax not in fpos.tax_ids.tax_src_id:
|
||||
|
||||
Reference in New Issue
Block a user