Skip to content

[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
microsoft:mainfrom
sanjmaurya:bugs/Bug-640410---master]UnbalancedG/LEntriesIfyouApply-PaymentPostedPurchase

Conversation

@sanjmaurya

@sanjmaurya sanjmaurya commented Jul 1, 2026

Copy link
Copy Markdown

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.

@github-actions github-actions Bot added From Fork Pull request is coming from a fork Linked Issue is linked to a Azure Boards work item labels Jul 1, 2026
@github-actions github-actions Bot added this to the Version 29.0 milestone Jul 1, 2026
@sanjmaurya sanjmaurya closed this Jul 1, 2026
@sanjmaurya sanjmaurya reopened this Jul 1, 2026
@sanjmaurya sanjmaurya marked this pull request as ready for review July 1, 2026 10:04
@sanjmaurya sanjmaurya requested a review from a team July 1, 2026 10:04
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Copilot PR Review

Iteration 1 · Outcome: completed

Knowledge source: https://github.com/microsoft/BCQuality@822cae1b2771ac25f665f73369f69093bd4fd630

Orchestrator pre-filter (13 file(s) excluded)

  • layer-disabled (knowledge) : 13 file(s)

Findings produced by the Copilot CLI agent against BCQuality at 822cae1b2771ac25f665f73369f69093bd4fd630. Reply 👎 on any inline comment to flag false positives.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

From Fork Pull request is coming from a fork Linked Issue is linked to a Azure Boards work item

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant