[29.x] BE's PEPPOL "escompte" compensation - #11038
Conversation
6b498eb to
00cfc1a
Compare
Good Sense Reviewer - Round 1Recommendation: Request ChangesWhat this PR doesThis change keeps Belgian escompte as a payment-discount allowance, adds an exempt compensating charge and tax subtotal, and adjusts PEPPOL monetary totals so the payable amount stays whole while VAT uses the discounted base. The invoice path covered by the test is coherent, and the new shared PEPPOL app hook reaches sales and service invoices and credit memos. The remaining problems are in mixed exempt-tax documents and the deprecated BaseApp credit memo path. Problem-solution fitFit: Partial The described invoice scenario is clear, and the main invoice behavior matches it. The change does not yet cover every related document path and cannot always assign the right exemption reason when an ordinary exempt subtotal is present. SuggestionsS1 (🔴 High): Exemption reason is applied too broadly S2 (🔴 High): BaseApp credit memos miss compensation Risk assessment and necessityRisk: High. The diff changes PEPPOL tax subtotals, allowance and charge totals, and BaseApp export behavior. A mistake can create legal XML with wrong totals or the wrong exemption reason. Necessity: The change is needed because Belgian escompte must keep VAT on the discounted base while the payable amount stays whole. The scope is mostly right, but it is incomplete.
|
|
…hether a line is a escompte compensation
Good Sense Reviewer - Round 2Recommendation: Request ChangesWhat this PR doesThe latest commits pass the current VAT amount line into exemption-reason selection, add tests for a genuine exempt breakdown next to the escompte compensation, and apply the same exemption-reason overload to the deprecated PEPPOL code. This fixes the mixed exempt-tax reason issue. The BaseApp credit memo export still does not add the compensation line before totals are rendered, so that path can still produce the old wrong totals. Status of previous suggestions
New observations (commits since round 1)None - the new commits only address the previous exemption-reason suggestion and add related tests. Risk assessment and necessityRisk: High. This area writes PEPPOL tax subtotals, allowance/charge totals, and payable amounts. The app path now separates ordinary exempt lines from the escompte compensation, but the deprecated credit memo path still has a financial XML regression surface. Necessity: The change is needed because Belgian escompte must keep VAT on the discounted base while the payable amount stays whole. The scope is still incomplete until credit memos in the deprecated PEPPOL path get the same compensation handling as invoices.
|
Backport of #11023 to
releases/29.x.In BE, there's this weird tradition that when you have a payment terms discount, the VAT is calculated with that discount as taxable base, even when the full amount (pre-discount) is shown in the total.
In our standard PEPPOL, payment discounts are added as AllowanceCharge, which is what is desired, but the totals then become less, which is not what they do in BE.
A previous attempt to fix this was to remove the AllowanceCharge for the VAT, which was incorrect, since the totals would now be mismatching. More over, the confusion of the recent move to this app from BaseApp, and branching of 28.x when the fix landed, made the fix unavailable for 28.4 (to be dealt in other PRs).
What the PR does
I didn't add BaseApp's test, since that code is going away anyway, in favor of the new place in E-Documents.
Fixes AB#649018