Skip to content

Bug 651509: [29.x] ICM 51000002083463: Close Income Statement duplicates or omits mixed LCY/USD amounts with Balance closing, with and without global dimensions - #12768

Merged
ventselartur merged 5 commits into
releases/29.xfrom
backport/releases/29.x/651509
Oct 22, 2026
Merged

ventselartur merged 5 commits into
releases/29.xfrom
backport/releases/29.x/651509

Conversation

@ventselartur

@ventselartur ventselartur commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Backport of #11894 for AB#651509

Backport-Source: github:#11894
Backport-Target: BCApps:releases/29.x
Backport-Path-Set: 619360cade099740fe14264a176158d22de189784300f6b8c31790e455439333
@ventselartur
ventselartur requested a review from a team October 13, 2026 13:32
@ventselartur
ventselartur requested a review from a team as a code owner October 13, 2026 13:32
@github-actions github-actions Bot added the Team: Finance GitHub request for Finance area label Oct 13, 2026
@github-actions github-actions Bot added this to the Version 29.1 milestone Oct 13, 2026
@alexei-dobriansky

Copy link
Copy Markdown
Contributor

Good Sense Reviewer - Round 1

Recommendation: Accept

What this PR does

This change fixes incorrect income-statement closing totals when source-currency groups are interleaved in G/L entry order. It replaces positional row skipping with a dictionary that processes each complete filtered group once.

The group key keeps the existing account, date, source-currency, business-unit, and selected global-dimension filters. Repeated records are skipped before journal aggregation, and the tracking dictionary is reset for each account. The W1, ES, and IT implementations are aligned, and the tests verify exact amounts, dimensions, journal balancing, posting, source-currency totals, and repeated closing behavior.

Problem-solution fit

Fit: Strong

The change directly removes the invalid assumption that entries in a filtered currency group are contiguous. The regression scenarios reproduce the incorrect totals before the fix and cover the affected closing configurations after the fix.

Suggestions

None.

Risk assessment and necessity

Risk: This affects financially sensitive year-end closing and retained-earnings amounts. The implementation is narrow, preserves the existing grouping criteria, is aligned across W1, ES, and IT, and has detailed regression coverage. Visiting each distinct filtered group may cost more than positional skipping, but the dictionary prevents repeated sum calculations and no realistic usability risk is evident.

Necessity: The change is required because the previous logic can create incorrect closing and retained-earnings totals. Manual correction is not a safe workaround for a posting process.


[AI-PR-REVIEW] version=1 promptVersion=4 system=github pr=12768 round=1 by=alexei-dobriansky at=2026-10-13T19:08:17Z lastSha=d4c900007f4910dc91734c68b6c121f90bf1df56 reviewKey=86e48afc7ed819a2b709f93ea8eb4eb1534f9200b396d258269db3754831cc72 suggestions=

Create an isolated source currency with a deterministic 0.25 exchange rate effective from the fiscal-year start, removing dependency on demo USD rates.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 77a301b0-00ce-45a1-b98d-b8e078f1adaa
@alexei-dobriansky

Copy link
Copy Markdown
Contributor

Good Sense Reviewer - Round 2

Recommendation: Accept

What this PR does

The new commit makes the regression setup independent of a pre-existing USD record. Each test now creates a fresh foreign currency with an exchange rate and uses that generated code consistently.

This keeps the intended 1:4 source-currency ratio, removes a country-data dependency, and leaves the production closing logic unchanged since round 1. The W1, CH, and IT test setup remains aligned, and the affected integration test suites pass.

Status of previous suggestions

No suggestions were raised in round 1.

New observations (commits since round 1)

None.

Risk assessment and necessity

Risk: The underlying change still affects financially sensitive year-end closing, but this round changes only test data setup and wording. It does not alter production behavior, public APIs, or the grouping rules reviewed in round 1.

Necessity: The test update is needed so the mixed-currency regression scenarios have a valid exchange rate on every country test database instead of depending on how USD was already configured.


[AI-PR-REVIEW] version=1 promptVersion=4 system=github pr=12768 round=2 by=alexei-dobriansky at=2026-10-19T13:36:37Z lastSha=bc73391360ed6aff5d3f9dd351efd37ef6ceeeec reviewKey=6b33960f8008fd1a8387d8dbe39fe58218812194f6f61de735ae911d4f6148d0 suggestions= parentRound=1

Align the localized request-page value queue and use the retained earnings account selected by the IT report.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: c30597be-a58b-4f56-8e03-a2d16659ef63
(cherry picked from commit 1deed91)
@alexei-dobriansky

Copy link
Copy Markdown
Contributor

Good Sense Reviewer - Round 3

Recommendation: Request Changes

What this PR does

The new commit aligns the Italian request-page queue with the localized report fields and uses one account for both the net-profit and net-loss closing lines.

The queue order now matches the handler, so the earlier value shift is fixed. However, the new account lookup adds analyzer warnings that fail both Italian build variants, so this round is not ready to merge.

Status of previous suggestions

No suggestions were raised in round 2.

New observations (commits since round 2)

S1 (🔴 High): Remove new AA0210 warnings from IT helper
The new helper filters G/L Account Category and G/L Account on fields that have no matching keys. This adds three AA0210 warnings, so both IT builds fail; use an existing test helper or account setup that avoids these non-key FindFirst filters.

Risk assessment and necessity

Risk: The production closing logic is unchanged in this round. The test update currently fails the IT build warning gate, so the localized regression tests cannot provide merge-ready validation.

Necessity: The queue alignment is needed for the localized request page and the financially sensitive closing tests. The account lookup must be changed so the test fix passes the repository's analyzer gate.


[AI-PR-REVIEW] version=1 promptVersion=4 system=github pr=12768 round=3 by=alexei-dobriansky at=2026-10-20T13:20:03Z lastSha=b2df3b576e349c37385af4ab54443d70fd4d07c0 reviewKey=64778d24c4c4ca04a681e1845b815797754568b4bf39dc7ad067e8a9e38a268b suggestions=S1@13dba7fd:new parentRound=2

Use the account category totaling filter instead of filtering on fields without keys.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 8716f85d-9b36-4a18-9a38-10f368725094
@alexei-dobriansky

Copy link
Copy Markdown
Contributor

Good Sense Reviewer - Round 4

Recommendation: Accept

What this PR does

The new commit changes the Italian test helper that finds the retained-earnings account. It replaces direct filters on non-key fields with a scan of the account categories and uses the category's existing totaling filter to select the account by its primary key.

The production closing logic is unchanged. The earlier analyzer warnings are removed from the new helper, while the test still selects an account assigned to the retained-earnings equity category and now reports a clear error when no such account exists.

Status of previous suggestions
ID Title Status Author response
S1 Remove new AA0210 warnings from IT helper Addressed The direct non-key filters were replaced with the existing category totaling filter and an account-number lookup.
New observations (commits since round 3)

None.

Risk assessment and necessity

Risk: This remains a financially sensitive year-end closing scenario, but this round changes only test setup. The lookup uses existing account-category behavior, does not change production code or public APIs, and fails clearly if the required setup is missing.

Necessity: The change is needed so the localized regression tests can pass the analyzer gate without using non-key filters. It preserves coverage for the retained-earnings posting path.


[AI-PR-REVIEW] version=1 promptVersion=4 system=github pr=12768 round=4 by=alexei-dobriansky at=2026-10-20T19:38:36Z lastSha=4a47ada7215b3e5c0e40480221653532d3f8065a reviewKey=568e53cca690f410ce873a33699ed5f71cebb20295018376a494c0046757933e suggestions=S1@13dba7fd:addressed parentRound=3

Carry explicit field loading, IT Details-mode balancing and currency test setup.
Source: #11894
Source-Commit: ca05fec

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: dbbaa964-123c-4b63-96ec-693923084c12
@alexei-dobriansky

Copy link
Copy Markdown
Contributor

Good Sense Reviewer - Round 5

Recommendation: Accept

What this PR does

This fixes year-end closing totals when local- and foreign-source-currency entries are interleaved. Each filtered group is summed once instead of skipping rows by position.

The new commit explicitly loads the fields used after aggregation in the W1, ES, and IT reports. This avoids later partial-record loads after the amount fields hold calculated group totals. The currency test helper keeps the same exchange rate while adding posting-account setup. The Italian test supplies a balancing account in Details mode, matching the localized report's later assignment, while keeping Balance mode unchanged.

Problem-solution fit

Fit: Strong

The grouping change addresses duplicated or omitted currency groups. The latest changes preserve those totals through subsequent field reads and make the localized test setup follow the report's posting contract.

Status of previous suggestions
ID Title Status Author response
S1 Remove new AA0210 warnings from IT helper Addressed The category scan and account-number totaling filter remain in place; the latest commit does not undo that fix.
New observations (commits since round 4)

None.

Risk assessment and necessity

Risk: Year-end closing is financially sensitive. The new production changes use the same field-loading list in all three report implementations and do not change grouping filters, event signatures, or public procedures. Tests check exact mixed-currency closing totals, dimensions, balanced journals, and zero balances after posting; separate tests cover grouped and ungrouped local-source-currency totals. All 166 completed non-skipped checks pass, with two checks skipped. Local AL builds and tests were not run during this review.

Necessity: Without the fix, interleaved currency groups can produce incorrect closing journals and leave income accounts incorrectly closed. Loading the aggregation and dimension fields before processing protects the calculated values, and the test setup changes support the existing posting scenarios.


[AI-PR-REVIEW] version=1 promptVersion=4 system=github pr=12768 round=5 by=alexei-dobriansky at=2026-10-22T15:43:24Z lastSha=8b94445cb3ff76a5bbe35d5a34166e0bc77197c4 reviewKey=be75456827f7d90350f91316637f85e394768b4abc72d6c4935a4e478e545301 suggestions=S1@13dba7fd:addressed parentRound=4

@ventselartur
ventselartur merged commit af1b860 into releases/29.x Oct 22, 2026
329 of 332 checks passed
@ventselartur
ventselartur deleted the backport/releases/29.x/651509 branch October 22, 2026 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Team: Finance GitHub request for Finance area

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants