Skip to content

Conversation

@sbejaoui
Copy link

Match taxes on UBL import using UNECE tax codes

Match taxes on UBL import using UNECE tax codes
tax = self.env["account.tax"].search(
self._get_tax_by_amount_and_unece_code_domain(
journal, amount, tax_unece_code
)
Copy link
Contributor

@hparfr hparfr Jan 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think there is a unicity constraint

Suggested change
)
),
limit=1

Copy link
Contributor

@jbaudoux jbaudoux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be safer, I would also parse the tax Scheme

<cac:TaxScheme>
<cbc:ID schemeID="UN/ECE 5153" schemeAgencyID="6">VAT</cbc:ID>
</cac:TaxScheme>

in order to search taxes that are VAT taxes

("amount_type", "=", "percent"),
("type_tax_use", "=", journal.type),
("amount", "=", amount),
("unece_categ_id.code", "=", tax_unece_code),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
("unece_categ_id.code", "=", tax_unece_code),
("unece_categ_id.code", "=", tax_unece_code),
("unece_type_id.code", "=", tax_type_code),

@jbaudoux jbaudoux added this to the 16.0 milestone Jan 9, 2026
Copy link

@phschmidt phschmidt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functionnal tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants