[Bug][SubscriptionBilling] Contract lines of type G/L Account never post to the selected G/L account (backport to releases/29.x) - #11069
Conversation
…ost to the selected G/L account (microsoft#9905) <!-- Thanks for contributing to BCApps! A few things before you hit "Create pull request": - Your PR must link to an approved issue. New here? See CONTRIBUTING.md. - You must have built and run your change yourself. CI is a safety net, not a substitute. - If you used AI or an agent to write this PR, you are still the author. Read the diff, build it, and try it before requesting review. Contributing guide: https://github.com/microsoft/BCApps/blob/main/CONTRIBUTING.md Local dev environment: https://github.com/microsoft/BCApps/blob/main/LOCAL_DEV_ENV.md --> ## What & why <!-- A few sentences: what does this change do, and what problem does it solve? --> post G/L Account contract lines to their own account 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. ## Linked work <!-- Required: link an approved GitHub issue using "Fixes #<number>". Microsoft contributors: also link the ADO work item with "AB#<number>" if you have one. --> Fixes microsoft#9885 [AB#648281](https://dynamicssmb2.visualstudio.com/1fcb79e7-ab07-432a-a3c6-6cf5a88ba4a5/_workitems/edit/648281) ## How I validated this - [x] I read the full diff and it contains only changes I intended. - [x] I built the affected app(s) locally with no new analyzer warnings. - [x] I ran the change in Business Central and confirmed it behaves as expected. - [x] I added or updated tests for the new behavior, or explained below why none are needed. **What I tested and the outcome** *(required — be specific: scenarios, commands, screenshots for UI changes)* 1. Posted a contract invoice for a Contract Line with GL Account without deferrals and observed that the GLAccount involved was used for Sales Invoice Posting. 2. Posted a contract invoice for a Contract Line with GL Account with deferrals, released defferals and observed that the GLAccount involved was used for moving deferrals to the correct GL Account. <!-- Example: - Ran the new "Post and Send" action on a sales invoice in a fresh container; document posted and email queued (see screenshot). - New unit tests in MyFeatureTest.Codeunit.al pass locally; full module test suite green. - No tests added because change is comment-only / refactor with existing coverage. --> ## Risk & compatibility <!-- Anything reviewers should watch for: breaking changes, upgrade/data impact, permissions, telemetry, feature flags, follow-up work. Write "None" if there's nothing to call out. --> - **Intentional behavior change:** contract lines of type "G/L Account" without 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. - **Schema:** purely additive — new field 27 "G/L Account No." on the 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. - **Relaxed validation:** Contract Deferrals Release no longer requires the 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). - **Credit memos:** reversal copies the deferral record, so the new field is propagated automatically. - **Test library:** ContractTestLibrary got a new overload; the existing CreateServiceObjectForGLAccountWithServiceCommitments signature is unchanged. - No permissions, telemetry, or feature-flag impact. No follow-up work planned. --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com> (cherry picked from commit 32df311)
|
Issue #9885 is not valid. Please make sure you link an issue that exists, is open and is approved. |
Good Sense Reviewer - Round 1Recommendation: AcceptWhat this PR doesThis backport makes Subscription Billing contract lines of type G/L Account post to the account selected on the contract line. It handles both immediate posting and contract deferral release for customer and vendor contracts. The change is targeted. For lines without deferrals, the existing BaseApp account chosen from the line is left unchanged. For lines with deferrals, the selected G/L account is stored on each deferral entry and used as the release account, while old deferrals still fall back to the setup account when the new field is blank. Problem-solution fitFit: Strong The bug says the selected G/L account had no effect on posting for this line type. The diff addresses the direct posting path, the deferral release path, and both customer and vendor flows. SuggestionsNone. Risk assessment and necessityRisk: This changes financial posting destinations for Subscription Billing G/L Account contract lines. The scope is limited to that line type, existing setup-account behavior remains for other line types and old deferral records, and no public procedure or event signature is changed. Necessity: The selected G/L account on the contract line should control the final revenue or cost account. The change is needed because both immediate posting and deferral release previously ignored that account, and the tests cover the customer and vendor paths with and without deferrals.
|
What & why
Linked work
Fixes #9885
AB#648281
How I validated this
What I tested and the outcome
-x) of the squash-merge commit 32df311 of [Bug][SubscriptionBilling] Contract lines of type G/L Account never post to the selected G/L account #9905 onto releases/29.x — the diff is identical to the original PR's diff, with no conflicts and no context drift. The squash commit carries both commits of the original PR: the fix itself and the test reorder that resolved the IT-localization CI failure.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