[IMP] account_edi_ubl_cii: Add function to apply filter on tax values

For SA, we need to be able to filter on the taxes exported, as
certain taxes should simply not be reported in the UBL.

X-original-commit: 6019e809b4eedfd5ba56e5f8b39ac4e830131390
Part-of: odoo/odoo#126353
This commit is contained in:
Mehdi Bendali Hacine
2023-06-26 21:10:29 +02:00
parent aecd5d464c
commit 9492a11d2a
@@ -337,6 +337,19 @@ class AccountEdiXmlUBL20(models.AbstractModel):
'price_vals': self._get_invoice_line_price_vals(line),
}
def _apply_invoice_tax_filter(self, base_line, tax_values):
"""
To be overridden to apply a specific tax filter
"""
return True
def _apply_invoice_line_filter(self, invoice_line):
"""
To be overridden to apply a specific invoice line filter
"""
return True
def _export_invoice_vals(self, invoice):
def grouping_key_generator(base_line, tax_values):
tax = tax_values['tax_repartition_line'].tax_id
@@ -357,7 +370,9 @@ class AccountEdiXmlUBL20(models.AbstractModel):
self._validate_taxes(invoice)
# Compute the tax details for the whole invoice and each invoice line separately.
taxes_vals = invoice._prepare_edi_tax_details(grouping_key_generator=grouping_key_generator)
taxes_vals = invoice._prepare_edi_tax_details(grouping_key_generator=grouping_key_generator,
filter_to_apply=self._apply_invoice_tax_filter,
filter_invl_to_apply=self._apply_invoice_line_filter)
# Fixed Taxes: filter them on the document level, and adapt the totals
# Fixed taxes are not supposed to be taxes in real live. However, this is the way in Odoo to manage recupel
@@ -462,7 +477,6 @@ class AccountEdiXmlUBL20(models.AbstractModel):
vals['vals']['credit_note_type_code'] = 381
return vals
def _export_invoice_constraints(self, invoice, vals):
constraints = self._invoice_constraints_common(invoice)
constraints.update({