[Main] [all-e]Unbalanced G/L Entries if you apply a Payment and a Posted Purchase Invoice having both different Posting Groups and using the "Applies-to Document No." on the line instead of using Apply Entries in the Spanish version.#8950
Open
sanjmaurya wants to merge 1 commit into
Conversation
Contributor
Copilot PR ReviewIteration 1 · Outcome: completed Knowledge source: https://github.com/microsoft/BCQuality@822cae1b2771ac25f665f73369f69093bd4fd630 Orchestrator pre-filter (13 file(s) excluded)
Findings produced by the Copilot CLI agent against BCQuality at |
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.
Bug 640410: [master] [all-e]Unbalanced G/L Entries if you apply a Payment and a Posted Purchase Invoice having both different Posting Groups and using the "Applies-to Document No." on the line instead of using Apply Entries in the Spanish version.
AB#640410
Issuse :- Bug 640409: [28.x] [all-e]Unbalanced G/L Entries if you apply a Payment and a Posted Purchase Invoice having both different Posting Groups and using the "Applies-to Document No." on the line instead of using Apply Entries in the Spanish version.
Cause :-
n GenJnlPostLine.Codeunit.al:
In CalcApplication, an application produces two detailed buffer entries (one for the payment ledger entry, one for the applied invoice). Both inherit "Document Type" = GenJnlLine."Document Type" (= Payment); they differ only by "CV Ledger Entry No.".
A Cartera special-case in PostDtldVendLedgEntry (added in PR 200509 / WI 557674) forced every such application entry to the payment line's posting-group payables account whenever "Applies-to Doc. No." <> '' and buffer "Document Type" = Payment. That condition wrongly matched the invoice-side entry too, so the invoice's closing posted to account 410 instead of 400 → 400 never cleared → imbalance.
"Apply Entries" sets Applies-to ID (not Applies-to Doc. No.), so the special-case was skipped — which is why only the inline path failed.
Solution :-
Added helper IsApplnEntryForAppliedVendorDoc that detects when an application detailed entry belongs to the applied document (its existing vendor ledger entry has a different Document Type than the payment line). The override now applies only to the payment's own entry (or an entry whose ledger entry isn't inserted yet), letting the applied invoice post to its own posting-group payables account via GetVendDtldCVLedgEntryBufferAccNo. Mirrored in PostDtldVendLedgEntryUnapply for apply/unapply symmetry.