[Bug][SubscriptionBilling]: "Prices Including VAT" handling is incomplete — contract billing invoice treats VAT‑exclusive Subscription Line amounts as VAT‑inclusive - #10093
Open
Miljan Milosavljević (miljance) wants to merge 1 commit into
Conversation
…usive when document prices include VAT
When a Subscription Contract is billed for a customer/vendor whose prices
include VAT, the contract invoice was created with the net (VAT-exclusive)
amount placed onto a "Prices Including VAT" = YES document, so the platform
treated that net value as gross and the resulting VAT base/amounts did not
reconcile with the original order.
Add a generic helper "ToVATInclusiveUnitPrice" that grosses up a net price by
the line's VAT factor (rounded to the currency's Unit-Amount Rounding
Precision), and apply it at every price-assignment site when the document has
"Prices Including VAT":
- Sales: standard line and usage-based path ("Unit Price")
- Purchase: standard line and usage-based path ("Direct Unit Cost")
Full VAT and zero-VAT lines are left untouched. The factor is determined
before the value is validated, so each price is validated exactly once.
Add tests covering the VAT-inclusive and prices-excluding-VAT cases for both
the customer (sales) and vendor (purchase) contract billing flows.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Miljan Milosavljević (miljance)
requested a review
from a team
as a code owner
August 10, 2026 13:42
Miljan Milosavljević (miljance)
temporarily deployed
to
triage
August 10, 2026 13:42 — with
GitHub Actions
Inactive
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
When a Subscription Contract is billed for a customer/vendor whose prices include VAT, the contract invoice was created with the net (VAT-exclusive) amount placed onto a "Prices Including VAT" = YES document, so the platform treated that net value as gross and the resulting VAT base/amounts did not reconcile with the original order.
Add a generic helper "ToVATInclusiveUnitPrice" that grosses up a net price by the line's VAT factor (rounded to the currency's Unit-Amount Rounding Precision), and apply it at every price-assignment site when the document has "Prices Including VAT":
Full VAT and zero-VAT lines are left untouched. The factor is determined before the value is validated, so each price is validated exactly once.
Add tests covering the VAT-inclusive and prices-excluding-VAT cases for both the customer (sales) and vendor (purchase) contract billing flows.
Linked work
Fixes #8642
How I validated this
What I tested and the outcome (required — be specific: scenarios, commands, screenshots for UI changes)
Risk & compatibility
Prices Including VAT= YES; every other document is byte-identical to before (asserted by the…PricesExcludeVATtests).local, event signatures and firing order unchanged. Subscribers on VAT-inclusive documents now see a gross price, which is the correct value for such a document./(1 + "VAT %"/100), so the gross-up is their exact inverse.Full VATis skipped on purpose. Sales Tax is not covered (the base app reverses it viaReverseCalculateTax), which NA setups don't combine withPrices Including VAT.Unit-Amount Rounding Precision; a net → gross → net round trip can land one rounding step off. Inherent to VAT-inclusive documents, and the document totals stay consistent.139687on BC29.0.53247; the VAT-inclusive assertion is mutation-verified (conversion disabled → red at157.69047vs143.35497).