[BR-O-05] When VAT category code is "O", invoice lines should not contain RateApplicablePercent#165
[BR-O-05] When VAT category code is "O", invoice lines should not contain RateApplicablePercent#165Betelgeuse1 wants to merge 3 commits into
Conversation
|
One thing missing though: the same change needs to be applied to the UBL writer. writer_ubl.go still writes cbc:Percent unconditionally: For a category "O" line this emits Suggested change, mirroring the CII writer: Would also be good to add a write/round-trip test for both CII and UBL asserting no rate is emitted for category O. That would have caught the UBL gap. |
c4aff8d to
a966183
Compare
|
I've fixed the UBL writing issue and added a condition in both UBL and CII round trip test. |
|
Thank you very much for your patience. I have to admit that I was lazy this time (very busy), so I asked the AI for help, and this is the finding. I cannot judge right now if this is correct or not, please bear with me if this is nonsense: One blocker before this can be merged, though: the UBL writer change breaks the XSD element order. In writer_ubl.go, cbc:Percent was moved after cac:TaxScheme: cac:ClassifiedTaxCategory (UBL TaxCategoryType) has a fixed sequence: cbc:ID, cbc:Name, cbc:Percent, …, cac:TaxScheme — so cbc:Percent must come before cac:TaxScheme. As written, this produces XSD-invalid UBL for Could you keep the original order and just wrap the condition around the Percent element? The CII writer is fine as-is, since RateApplicablePercent sits at the end of that sequence anyway. A small follow-up suggestion: a UBL test that asserts the actual element order in the generated XML (rather than just round-tripping) would catch this class of issue going forward. |
The FNFE validator enforces the rule BR-O-5, which stipulates :
We could also remove
RateApplicablePercentfrom the document levelApplicableTradeTax.However, the BR-DE-14 says :
So for the best of both world, I only removed
RateApplicablePercentat the invoice lines level.