[Subscription Billing] Fix deferral creation, release, and credit memo handling #6636
+743
−306
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.
Summary
This pull request introduces a new data upgrade step to populate posting group fields in contract deferral records, along with some code clean-up and improvements/fixes across related modules.
Extensibility: Five core deferral objects need integration points (events) for ISV extensions to customize behavior during deferral creation and release processes.
Missing Posting Groups in Deferrals: Contract deferrals cannot be released when the original posted documents are unavailable (e.g., in data migration scenarios), because posting group information is retrieved from posted invoice/credit memo lines instead of being stored in the deferral entries.
Zero-Amount Deferrals: The system creates unnecessary deferral entries and G/L postings for contract lines with 0.00 amounts, leading to excessive ledger entries with no financial impact.
Inconsistent Partial Period Handling: Vendor contract deferrals handle partial billing periods inconsistently—some invoices are deferred based on full months while others are calculated daily, causing incorrect revenue recognition.
Credit Memo Deferral Gap: Credit memos with amounts exceeding the original invoice amount do not generate corresponding deferral entries, resulting in incomplete revenue recognition.
Double Deferral Generation: When both contract-based deferrals and standard deferral codes are used, deferrals are incorrectly created in both systems simultaneously.
Work Item(s)
Fixes #6281