fix(invoices): persist recalculated update totals as JSON (H24) #53
Loading…
Reference in a new issue
No description provided.
Delete branch "Seyyed/Seyyed_arc:codex/team-base-14-h24-update-totals-json"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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.