Skip to content

fix: accept swiss VAT IDs from customers#233

Merged
barredterra merged 3 commits intodevelopfrom
swiss-vat-ids
Feb 19, 2026
Merged

fix: accept swiss VAT IDs from customers#233
barredterra merged 3 commits intodevelopfrom
swiss-vat-ids

Conversation

@barredterra
Copy link
Copy Markdown
Member

@barredterra barredterra commented Feb 19, 2026

This pull request adds support for validating and normalizing Swiss VAT IDs (UIDs) within the European e-invoice system. The main changes include implementing Swiss VAT ID validation logic, integrating this logic into the sales invoice workflow, and adding corresponding unit tests.

Swiss VAT ID validation and normalization:

  • Added normalize_swiss_vat_id and is_valid_swiss_vat_id functions to eu_einvoice/switzerland.py for cleaning and validating Swiss VAT IDs according to official rules, including checksum verification.
  • Integrated Swiss VAT ID validation into the _set_buyer_tax_id method in sales_invoice.py, so that Swiss VAT IDs are recognized and normalized before further processing.
  • Imported the new Swiss VAT ID utilities in sales_invoice.py to enable their use.

Testing:

  • Added unit tests in test_switzerland.py to verify the correctness of the Swiss VAT ID validation logic, including both valid and invalid cases.

Copy link
Copy Markdown
Member

@HenningWendtland HenningWendtland left a comment

Choose a reason for hiding this comment

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

Tested and it worked for me after applying the suggested change removing the suffixes. Checked also with the debugger that this was the problem.

@HenningWendtland
Copy link
Copy Markdown
Member

Also the test file is missing a "." in the name, so it does not run

@barredterra
Copy link
Copy Markdown
Member Author

@Mergifyio backport version-16-hotfix version-15-hotfix

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Feb 19, 2026

backport version-16-hotfix version-15-hotfix

✅ Backports have been created

Details

@barredterra barredterra merged commit b8575ea into develop Feb 19, 2026
10 checks passed
@barredterra barredterra deleted the swiss-vat-ids branch February 19, 2026 23:59
mergify bot pushed a commit that referenced this pull request Feb 19, 2026
* fix: accept swiss VAT IDs from customers

* fix: validate_swiss_vat

* refactor: normalize and validate vat id

(cherry picked from commit b8575ea)
mergify bot pushed a commit that referenced this pull request Feb 19, 2026
* fix: accept swiss VAT IDs from customers

* fix: validate_swiss_vat

* refactor: normalize and validate vat id

(cherry picked from commit b8575ea)
barredterra added a commit that referenced this pull request Feb 20, 2026
* fix: accept swiss VAT IDs from customers

* fix: validate_swiss_vat

* refactor: normalize and validate vat id

(cherry picked from commit b8575ea)

Co-authored-by: Raffael Meyer <14891507+barredterra@users.noreply.github.com>
barredterra added a commit that referenced this pull request Feb 20, 2026
* fix: accept swiss VAT IDs from customers

* fix: validate_swiss_vat

* refactor: normalize and validate vat id

(cherry picked from commit b8575ea)

Co-authored-by: Raffael Meyer <14891507+barredterra@users.noreply.github.com>
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.

2 participants