[FIX] l10n_eu_service: don't create OSS fiscal positions in multivat setup
Multivat means you are submitting its national tax report to a foreign country. In this case, you never want to use OSS taxes for that country. Hence, we exclude the countries for which we are submitting such a report when generating the fiscal positions for OSS. closes odoo/odoo#77080 X-original-commit: ab2d2916e469586bb6c2b63c49de766369aa7277 Signed-off-by: Laurent Smet <smetl@users.noreply.github.com> Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
This commit is contained in:
@@ -33,13 +33,20 @@ class Company(models.Model):
|
||||
('company_id', '=', company.id),
|
||||
('country_id', '=', company.account_fiscal_country_id.id),
|
||||
('tax_group_id', 'not in', oss_tax_groups.mapped('res_id'))])
|
||||
for country in eu_countries - company.account_fiscal_country_id:
|
||||
|
||||
multi_tax_reports_countries_fpos = self.env['account.fiscal.position'].search([
|
||||
('company_id', '=', company.id),
|
||||
('foreign_vat', '!=', False),
|
||||
])
|
||||
oss_countries = eu_countries - company.account_fiscal_country_id - multi_tax_reports_countries_fpos.country_id
|
||||
for country in oss_countries:
|
||||
mapping = []
|
||||
fpos = self.env['account.fiscal.position'].search([
|
||||
('country_id', '=', country.id),
|
||||
('company_id', '=', company.id),
|
||||
('auto_apply', '=', True),
|
||||
('vat_required', '=', False)], limit=1)
|
||||
('vat_required', '=', False),
|
||||
('foreign_vat', '=', False)], limit=1)
|
||||
if not fpos:
|
||||
fpos = self.env['account.fiscal.position'].create({
|
||||
'name': 'OSS B2C %s' % country.name,
|
||||
|
||||
Reference in New Issue
Block a user