[Bug][SubscriptionBilling] Contract lines of type G/L Account never post to the selected G/L account (backport to releases/28.x) - #10091
Conversation
Subscription Billing contract lines of type "G/L Account" always posted to the Customer/Vendor Subscription Contract Account from the General Posting Setup, ignoring the account actually selected on the contract line. - Without deferrals, CustomerDeferralsMngmt/VendorDeferralsMngmt now skip the General Posting Setup account lookup for "G/L Account" lines so the invoice posts directly to the line's account. - With deferrals, a new "G/L Account No." field (27) on Cust./Vend. Sub. Contract Deferral carries the account from the sales/purchase line, and is surfaced on the Customer/Vendor Contract Deferrals pages. - ContractDeferralsRelease now posts to that account when releasing the deferral, falling back to the General Posting Setup account when it is blank, and only requires the General Posting Setup account to be filled when no contract-line account is available. - Added TDD tests to CustomerDeferralsTest and VendorDeferralsTest covering both the immediate-posting and deferral-release paths, with a shared fixture in ContractTestLibrary. Fixes microsoft#9885 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Agentic PR Review - Round 1Recommendation: Accept with SuggestionsWhat this PR doesThis is a backport of PR #9905 to For lines without deferrals, the fix adds an early exit in For lines with deferrals, a new field 27 The two paths are handled correctly and symmetrically for Customer and Vendor. SuggestionsS1 - Credit memo path has no explicit test Risk assessment and necessityRisk: This is an intentional behavior change: G/L Account contract lines without deferrals now post to the account on the line instead of the GPS Customer/Vendor Subscription Contract Account. Customers who relied on the old (incorrect) routing will see amounts on different accounts going forward. The schema change (field 27) is purely additive with a safe GPS fallback, so upgrade is safe. The backport has not been built or test-run against a 28.x environment, which is a small extra risk for a financial area. Necessity: Issue #9885 clearly describes the bug and the expected behavior. The fix is targeted — it addresses both the non-deferral and deferral paths, adds tests for both, and does not touch unrelated code. The scope is right for a bug fix.
|
…ests On the IT localization the CI pipeline failed for the two new vendor tests with "The record in table Payment Lines already exists". The IT Base Application inserts a transient Payment Lines record (Type "General Journal", blank journal key) in Purch.-Post.CheckAndUpdate for every posted invoice and consumes/deletes it in GenJnlPostLine.PostVend.InitPaymentTerms, which filters on the journal template name of the posted line. The pre-existing test DeferralsReleaseSucceedsWhenGLAccountHasDefaultDeferralTemplateAndJournalTemplMandatory enables "Journal Templ. Name Mandatory", so its posting leaves that record orphaned (the consuming filter no longer matches the blank template). With codeunit-level test isolation the orphan survives into subsequent tests, and any later purchase-invoice posting in the codeunit fails on the duplicate insert - which hit the two new G/L Account tests, the only posting tests declared after it (its NotMandatory sibling is already on the DisabledTests list for the same reason). Move the two tests to their alphabetical position earlier in the codeunit so they post before the orphan is created, matching how every other posting test in the suite avoids the trap. No test logic changed. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> (cherry picked from commit 91fa021)
Good Sense Reviewer - Round 2Recommendation: Accept with SuggestionsWhat this PR doesThe latest update only moves the new vendor G/L Account deferral tests earlier in the test codeunit so they run before the journal-template cleanup test. The test bodies are unchanged, and the move is safe. The backport still matches the intended Subscription Billing fix: G/L Account contract lines keep the selected account for immediate posting, and deferral release uses the account carried on the deferral record with a safe fallback for old records. Status of previous suggestions
New observations (commits since round 1)None - the new commit only reorders tests. Risk assessment and necessityRisk: This is a financial posting change, so the main risk is posting to the wrong account. The implementation stays narrow and the added field is backward-compatible because blank values keep the old setup-account behavior. The remaining risk is limited to the untested credit memo reversal path. Necessity: The bug is important because the selected G/L account on the contract line should affect the final posting. The backport scope is appropriate and mirrors the main fix, with the same non-blocking test gap noted above.
|
What & why
Linked work
Fixes #9885
How I validated this
What I tested and the outcome
Risk & compatibility
deferrals now post to the G/L account selected on the line instead of the
Cust./Vend. Subscription Contract Account from General Posting Setup. Anyone
who relied on the old (incorrect) routing will see revenue/cost on different
accounts going forward.
Cust./Vend. Sub. Contract Deferral tables. No breaking changes, no upgrade
code needed: the field is blank on pre-existing deferral rows, and release
falls back to the General Posting Setup account, so existing deferrals
release exactly as before.
General Posting Setup contract account when the deferral carries its own
account — setups with a blank GPS account now succeed where they previously
errored (intended).
propagated automatically.
CreateServiceObjectForGLAccountWithServiceCommitments signature is unchanged.
🤖 Generated with Claude Code