سامانه صدور فاکتور و حسابداری
docs(treasury): record owner continuation and bounded payment amendment scope
davoodmehraban89 committed
Oct 14, 2026 at 10:49 UTC
628481a0ebbb79acccf5dddb24c958fac97e1ce6
1 file changed
+8
PROJECT_STATE.md
+8
@@ -231,6 +231,14 @@ The latest user message is the sole source of new instructions. Read AGENTS.md t
231
- **Financial/operational limits:** Existing live customer financial records, permissions, RLS, roles, schema, Stripe, SMS and production DB rows were not modified by this source release. Sale/purchase historical accounting remains immutable. This is an application-level linked revision workflow using multiple sync stages, not independently verified as one server-side atomic amendment transaction; if a stage loses server confirmation, recovery must inspect state before retry. Closed periods, settled allocations, submitted tax invoices and historical unlinked vouchers still fail closed. Manual journal, payment/receipt, expense/income, taxpayer and multi-tenant concurrent correction acceptance remain separate tasks. F0-01 slow real owner sign-in still open.
232
- **User-visible acceptance next:** In browser, refresh site, open posted purchase/sale, select اصلاح فاکتور, verify original number and edit form; cancel = zero posting, then authorized disposable test edit/save/print yields one visible record and same number after reload, while auditing all linked vouchers. Never use actual production business financial records solely as test fixtures.
233
234
+### 2026-10-14 Owner: continue Finora development — P0 treasury receipt/payment amendment slice OPEN
235
+- **Owner latest instruction:** «ادامه کار توسعه پیش ببر». Same-document sale/purchase UX PR #128 has been released; prior auth startup F0-01 still OPEN/deferred, no owner-authenticated acceptance claimed. Work on next independent Phase 3 treasury source corrections, preserving original document in employee view, without adding technical revision rows or changing posted accounting.
236
+- **Read-only baseline:** protected `main=b4d5da725a68af6c2a534422d3de85c13bf17b4d`; exact-main Quality `38524072782`, Security `38524072853`, Release `38524404953` and Pages `38524466785` all SUCCESS. Supabase `hcsixhqbyuhpshfwqpjx` ACTIVE_HEALTHY. This status is CI/provider metadata, not a customer login or genuine bank transfer test.
237
+- **Confirmed source problem:** `js/payments.js` posts new receipt/payment entries via `jePostSourceRecord`, but `editPayment` on a linked posted source reaches `jeGuardSourceMutation` and blocks saving. `deletePayment` likewise guards immutable journal; project cash totals and invoice outstanding currently aggregate raw payment rows, which would double count additive revisions unless filtered. `js/journal-engine.js` only allows posted historical correction through balanced compensating reversal; old source and voucher must remain immutable.
238
+- **First narrow authorized slice:** One **current visible** payment/receipt with same reference/date/form, backend correction version chain; only `cash`, `bank`, `card` postings **without** invoice allocation, cheque instrument or external reconciliation link. Preserve original direction, counterparty/company/project; allow changing amount/method/reference/note, creating no financial event on Open/Cancel. On Save, validate open fiscal year, current posted source, operator company/permission, source linkage and correction lineage; only then create linked balanced reversal and new posted source/ledger. Fold past revisions in `renderPayments`, derived cash/project totals and any allocated payment aggregates; visible delete of posted record must mean auditable reversal, not physical deletion. Deny or hold linked invoice/cheque and legacy unlinked records until separate reconciliation tests. No third-party banking action or external SMS.
239
+- **Required tests:** isolated browser mock with synthetic user/company and payment: open+cancel zero ledger writes; revise→reversal→new balanced posted voucher→same visible row after reload; original posted lines/metadata untouched; treasury totals count current revision once; reject allocated or cheque; fiscal-year lock; double-click/idempotency; aborted sync fail-closed and no duplicate blind retry. Existing Chromium Golden accounting and 3 disposable PostgreSQL, Security/CodeQL, exact main Release+Pages gates. No production financial data writes, schema/RLS/role/Auth changes, new paid costs. If tests reveal unsatisfied integrity, do not merge.
240
+- **Owner acceptance:** native browser authenticated test still OPEN. Rollback targeted code PR; legitimate future financial reversals remain historical and cannot be destroyed by reverting code.
241
+
242
## Current change ledger
243
| 2026-10-07 | Owner requested accounting/product usability refinement from live screenshots: automatic non-user-entered floating-detail codes, contextual in-product guides (especially accounting/chart/dimensions), remove duplicate product internal tax ID and use product code as internal item ID, strengthen in-control product/person search, introduce hierarchical product group/subgroup coding with deterministic 6-digit product codes, and keep sale/purchase commercial-document workspace layout stable while only semantic fields change. | **IMPLEMENTED / LOCAL VERIFICATION PASSED / CI PENDING** | Baseline main = `7e58c75f7d754f378d94ca3f356c1ae580aa7ee3`. Automatic dimension type/value codes, contextual guides, product-code-as-internal-ID, normalized multi-token search, and additive six-digit product coding implemented. Existing historical codes preserved. Commercial sale/purchase workspaces now share a stable `صدور سند تجاری` header/actions layout; duplicate purchase sidebar injection removed; the public selector is the single document-type selector and the legacy internal invoice-kind control is hidden. Local syntax/static/commerce/UX/accounting phases 2–6/Golden checks passed; protected-branch CI remains pending. |
244