Odoo18-Base/addons/l10n_it_edi/models/account_chart_template.py
2025-03-10 11:12:23 +07:00

27 lines
1.0 KiB
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models
class AccountChartTemplate(models.Model):
_inherit = 'account.chart.template'
def _load(self, company):
"""
Override normal default taxes, which are the ones with lowest sequence.
"""
result = super()._load(company)
template = company.chart_template_id
if template == self.env.ref('l10n_it.l10n_it_chart_template_generic'):
company.account_sale_tax_id = self.env.ref(f'l10n_it.{company.id}_22v')
company.account_purchase_tax_id = self.env.ref(f'l10n_it.{company.id}_22am')
tax = self.env.ref(f'l10n_it.{company.id}_00eu', raise_if_not_found=False)
if tax:
tax.write({
'l10n_it_has_exoneration': True,
'l10n_it_kind_exoneration': 'N3.2',
'l10n_it_law_reference': 'Art. 41, DL n. 331/93',
})
return result