Skip to content

Add support for exemption reasons as well as code#720

Open
alvarolivie wants to merge 8 commits intomainfrom
en16931-exemption-extension
Open

Add support for exemption reasons as well as code#720
alvarolivie wants to merge 8 commits intomainfrom
en16931-exemption-extension

Conversation

@alvarolivie
Copy link
Contributor

@alvarolivie alvarolivie commented Feb 19, 2026

  • Added cleaner support for exemption reasons in en16931.
  • Can separate pero tax category with note extensions.
  • I have removed some scenarios from regimes. These do not get normalized and I believe they are deprecated. Please review this part as I am not sure.

Pre-Review Checklist

  • Opened this PR as a draft
  • Read the CONTRIBUTING.md guide.
  • Performed a self-review of my code.
  • Added thorough tests with at least 90% code coverage.
  • Modified or created example GOBL documents to show my changes in use, if appropriate.
  • Added links to the source of the changes in tax regimes or addons, either structured or in the comments.
  • Run go generate . to ensure that the Schemas and Regime data are up to date.
  • Reviewed and fixed all linter warnings.
  • Been obsessive with pointer nil checks to avoid panics.
  • Updated the CHANGELOG.md with an overview of my changes.
  • Requested a review from Copilot and fixed or dismissed (with a reason) all the feedback raised.

Only after checking off all the previous items:

  • Marked this PR as ready for review and requested one from @samlown.

@codecov
Copy link

codecov bot commented Feb 19, 2026

Codecov Report

❌ Patch coverage is 89.24731% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.03%. Comparing base (54ba861) to head (808acd5).

Files with missing lines Patch % Lines
addons/eu/en16931/bill.go 86.84% 5 Missing and 5 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #720      +/-   ##
==========================================
- Coverage   93.05%   93.03%   -0.03%     
==========================================
  Files         333      333              
  Lines       17794    17881      +87     
==========================================
+ Hits        16558    16635      +77     
- Misses        870      875       +5     
- Partials      366      371       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR enhances the EN 16931 addon to support exemption reason notes (BT-120) through a more flexible approach. Instead of using regime-specific scenarios that automatically inject notes, the addon now allows users to provide custom exemption notes that are automatically normalized with the appropriate tax category extensions. The PR also removes deprecated reverse-charge scenarios from the DE and FR regimes, as this functionality is now better handled by the EN16931 addon.

Changes:

  • Added validation requiring exempt tax categories to have either a CEF VATEX code or an exemption note explaining the reason
  • Implemented automatic normalization of notes with src field matching tax keys (e.g., "exempt", "reverse-charge") to add the untdid-tax-category extension
  • Removed reverse-charge scenarios from DE and FR regimes since EN16931 addon now handles this more flexibly

Reviewed changes

Copilot reviewed 15 out of 16 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
regimes/fr/scenarios.go Deleted - removes reverse-charge scenario that added a hardcoded French note
regimes/fr/fr.go Removes reference to invoiceScenarios
regimes/de/scenarios.go Deleted - removes reverse-charge scenario that added a hardcoded German note
regimes/de/de.go Removes reference to invoiceScenarios
data/regimes/fr.json Generated file reflecting removal of scenarios from FR regime
data/regimes/de.json Generated file reflecting removal of scenarios from DE regime
addons/eu/en16931/tax_combo.go Adds validation preventing VATEX codes on non-exempt tax categories
addons/eu/en16931/tax_combo_test.go Updates tests to cover new VATEX validation rules
addons/eu/en16931/org.go Adds normalization logic to set untdid-tax-category extension on notes with tax key src values
addons/eu/en16931/en16931.go Adds documentation explaining exemption notes requirements and usage
addons/eu/en16931/bill.go Adds comprehensive validation for exemption notes including duplicate detection and orphan notes
addons/eu/en16931/bill_test.go Adds extensive test coverage for exemption note validation scenarios
data/addons/eu-en16931-v2017.json Generated file reflecting documentation updates to EN16931 addon
examples/de/invoice-de-es-xr.yaml Updates example to use manual note with src field instead of tax tag
examples/de/out/invoice-de-es-xr.json Generated output showing new note structure with untdid-tax-category extension
CHANGELOG.md Documents the addition of exemption reason notes support

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@alvarolivie alvarolivie marked this pull request as ready for review March 4, 2026 12:37
@alvarolivie alvarolivie requested a review from samlown March 4, 2026 12:38
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