Skip to content

[17.0][FIX] intrastat_product: Use Odoo's VAT validation instead of stdnum.vatin.is_valid#309

Merged
OCA-git-bot merged 1 commit intoOCA:17.0from
ForgeFlow:17.0-fix-intrastat_product-no_longer_use_stdnum.vatin_library
Jul 4, 2025
Merged

[17.0][FIX] intrastat_product: Use Odoo's VAT validation instead of stdnum.vatin.is_valid#309
OCA-git-bot merged 1 commit intoOCA:17.0from
ForgeFlow:17.0-fix-intrastat_product-no_longer_use_stdnum.vatin_library

Conversation

@AndreuOForgeFlow
Copy link
Copy Markdown
Contributor

This replaces the use of is_valid from the stdnum.vatin library with Odoo's validation logic in the VAT constraint check.

The stdnum.vatin.is_valid() function expects VAT numbers to be in international format, i.e., prefixed with the country code (e.g., ESB66676008), and will return False if the VAT is not prefixed. In contrast, the validation that's used in Odoo (https://github.com/odoo/odoo/blob/211629b232861b960f6650f980d1e3b6acac94d9/addons/base_vat/models/res_partner.py#L184) supports local VAT numbers (e.g., B66676008) without requiring the country prefix, because it combines the VAT value with the partner's country_id.

@pedrobaeza pedrobaeza added this to the 17.0 milestone Jul 3, 2025
Comment thread intrastat_product/models/intrastat_product_declaration.py
@AndreuOForgeFlow AndreuOForgeFlow force-pushed the 17.0-fix-intrastat_product-no_longer_use_stdnum.vatin_library branch from b256b27 to ca7605f Compare July 3, 2025 14:47
@AndreuOForgeFlow AndreuOForgeFlow force-pushed the 17.0-fix-intrastat_product-no_longer_use_stdnum.vatin_library branch from ca7605f to 4379884 Compare July 3, 2025 14:48
Copy link
Copy Markdown
Contributor

@GuillemCForgeFlow GuillemCForgeFlow left a comment

Choose a reason for hiding this comment

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

makes sense 👍🏿

@pedrobaeza
Copy link
Copy Markdown
Member

Please fw-port it to 18:

/ocabot merge patch

@OCA-git-bot
Copy link
Copy Markdown
Contributor

Hey, thanks for contributing! Proceeding to merge this for you.
Prepared branch 17.0-ocabot-merge-pr-309-by-pedrobaeza-bump-patch, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit f71a3c2 into OCA:17.0 Jul 4, 2025
5 of 7 checks passed
@OCA-git-bot
Copy link
Copy Markdown
Contributor

Congratulations, your PR was merged at 86ea03b. Thanks a lot for contributing to OCA. ❤️

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants