fix(invoices): persist recalculated update totals as JSON (H24) #53

Merged
morrning merged 2 commits from Seyyed/Seyyed_arc:codex/team-base-14-h24-update-totals-json into master 2026-11-13 00:25:19 +03:30
Contributor

Scope

A full invoice UPDATE without input totals uses the existing server calculation. Serialize only the storage copy of its Decimal totals using the same JSON number format as CREATE. If the whole extra_info is omitted, do not reuse the previous document's totals for the rewritten lines. The existing global-discount calculation, client numeric totals path, and payment-only path still apply.

On base 2354c27d50, a rewrite without totals failed with Object of type Decimal is not JSON serializable. Omitting the entire extra_info could also leave receivable 550 after replacing the line with a 600 + 60 tax line.

Evidence

In isolated SQLite, CREATE and equivalent UPDATE payloads with and without numeric totals persisted the same totals and GL. At gross 600, the standard sale posted receivable 660 and tax 60. Coupon 50 plus 10 points posted receivable 594, discount 60 and tax 54. A subsequent payment-only UPDATE of 100 preserved invoice totals and GL and left 560 outstanding.

48 selected pytest cases passed, including H23, payments-only, payable, receipt and accounting regressions. This verification called the services directly using SQLite. PostgreSQL and live HTTP were not exercised. Full H24 header-total validation remains open.

## Scope A full invoice UPDATE without input totals uses the existing server calculation. Serialize only the storage copy of its Decimal totals using the same JSON number format as CREATE. If the whole extra_info is omitted, do not reuse the previous document's totals for the rewritten lines. The existing global-discount calculation, client numeric totals path, and payment-only path still apply. On base 2354c27d50cc1b0561c822be51024f43a312fba3, a rewrite without totals failed with Object of type Decimal is not JSON serializable. Omitting the entire extra_info could also leave receivable 550 after replacing the line with a 600 + 60 tax line. ## Evidence In isolated SQLite, CREATE and equivalent UPDATE payloads with and without numeric totals persisted the same totals and GL. At gross 600, the standard sale posted receivable 660 and tax 60. Coupon 50 plus 10 points posted receivable 594, discount 60 and tax 54. A subsequent payment-only UPDATE of 100 preserved invoice totals and GL and left 560 outstanding. 48 selected pytest cases passed, including H23, payments-only, payable, receipt and accounting regressions. This verification called the services directly using SQLite. PostgreSQL and live HTTP were not exercised. Full H24 header-total validation remains open.
morrning merged commit efc056cb0b into master 2026-11-13 00:25:19 +03:30
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
hesabix/arc!53
No description provided.