|
|
for fiscal_position in self:
if (
not fiscal_position.foreign_vat
or not fiscal_position.country_id
or self.env['account.tax'].search([('country_id', '=', fiscal_position.country_id.id)], limit=1)
):
fiscal_position.foreign_vat_header_mode = False
else:
template_code = self.env['account.chart.template']._guess_chart_template(fiscal_position.country_id)
template = self.env['account.chart.template']._get_chart_template_mapping()[template_code]
# 'no_template' kept for compatibility in stable. To remove in master
fiscal_position.foreign_vat_header_mode = 'templates_found' if template['module'] in self.env['ir.module.module']._installed() else 'no_template'
|
|