Skip to content

Bug 653927: [29.x] [SAF-T NO] TotalDebit and TotalCredit differ from exported amounts after reversals - #12899

Merged
Aleksandr Gladkov (AleksanderGladkov) merged 1 commit into
releases/29.xfrom
backport/releases/29.x/653927
Oct 21, 2026
Merged

Aleksandr Gladkov (AleksanderGladkov) merged 1 commit into
releases/29.xfrom
backport/releases/29.x/653927

Conversation

@AleksanderGladkov

@AleksanderGladkov Aleksandr Gladkov (AleksanderGladkov) commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Backport of #12696 for AB#653927

Backport-Source: github:#12696
Backport-Target: BCApps:releases/29.x
Backport-Path-Set: 4da2ac75904103ff1aa49537aac384ce27d1fb12915693703cff6125c1dab0a2
@github-actions github-actions Bot added the Team: Finance GitHub request for Finance area label Oct 15, 2026
@github-actions github-actions Bot added this to the Version 29.1 milestone Oct 15, 2026
@alexei-dobriansky

Copy link
Copy Markdown
Contributor

Good Sense Reviewer - Round 1

Recommendation: Accept

What this PR does

This change recalculates SAF-T 1.30 debit and credit control totals from the sign of each selected G/L entry amount. It keeps SAF-T 1.20 behavior unchanged and repeats the full selection totals in every split file.

The new aggregate uses the same posting-date and source-code filters as the line exporter. Positive amounts are summed as debits, while negative amounts are converted to positive credit totals, which matches the XML line classification. The regression tests cover reversals, negative entries, multiple and blank source codes, period limits, empty selections, foreign currency, and monthly and daily splits.

Problem-solution fit

Fit: Strong

The change directly fixes the reported mismatch between the control totals and the exported line amounts. Its scope is limited to SAF-T 1.30, where the XML uses sign-based debit and credit classification.

Suggestions

None.

Risk assessment and necessity

Risk: This affects financial audit-file control totals, so a wrong sign or filter could produce a non-compliant export. The implementation reuses the exporter's source-code selection, uses a read-only SQL aggregate, changes no public API or event contract, and has focused regression coverage.

Necessity: Without this change, reversals and other negative entries can make SAF-T 1.30 control totals disagree with the amounts in the exported files. The fix is targeted and preserves the existing SAF-T 1.20 calculation.


[AI-PR-REVIEW] version=1 promptVersion=4 system=github pr=12899 round=1 by=alexei-dobriansky at=2026-10-15T14:12:54Z lastSha=f1bc370ecd1f1597ab7e5d9c688973db4f06e0a6 reviewKey=73722dfbecf39ccd0956cd08e6d9a0d47efaa8a0736b4dc335f28bf55050c297 suggestions=

@AleksanderGladkov
Aleksandr Gladkov (AleksanderGladkov) merged commit a94b5e8 into releases/29.x Oct 21, 2026
489 of 493 checks passed
@AleksanderGladkov
Aleksandr Gladkov (AleksanderGladkov) deleted the backport/releases/29.x/653927 branch October 21, 2026 08:29

This branch was successfully deployed

1 active deployment
triage — f1bc370e Deployed Oct 15, 2026 by AleksanderGladkov via Classify team ownership #8047
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.

5 participants