سامانه صدور فاکتور و حسابداری

docs: record owner's same-document amendment UX and deferred financial mutation contract

davoodmehraban89 committed Oct 14, 2026 at 09:42 UTC 8022b005ea552d5083654b6f07653b830de8a9e2
1 file changed +6
PROJECT_STATE.md
+6
@@ -211,6 +211,12 @@ The latest user message is the sole source of new instructions. Read AGENTS.md t
211 - **Still OPEN:** receipts/payments and expense/income source corrections, taxpayer-submitted documents, linked bank/warehouse allocations beyond bounded guards, legacy chartless records and closed fiscal years; two-user adversarial permission tests, production correction atomicity/reload and owner confirmation. Global 'all documents' request is partially implemented only; no bulk unposting or physical deletion of posted evidence. F0-01 slow startup remains separately OPEN.
212 - **Security/cost:** no production SQL DDL/DML, Auth/RLS/grant/role changes, external messaging, paid resource, existing posted ledger rewrite or live financial test transaction. Version rollback by reverting the targeted PR; real user reversal history, once created in future, is immutable and cannot be erased by reverting UI.
213
214 +### 2026-10-14 Owner UX correction — SAME visible document during pilot amendment — STARTED
215 +- **Exact latest owner instruction:** an employee clicks «اصلاح» on an existing finalized sales or purchase document and immediately edits **that same visible document, number, form and print view**. Employee must NOT see a "new invoice", correction suffix/ID or special bookkeeping messages; internal journal history remains with compensating reversal and properly posted amended transaction, never physical rewrite of historical accounting lines. Browser cancellation/no-op must NOT create a compensating entry. Save should complete amendment and maintain a single current visible document. Scope follows owner-approved sale/purchase and manual journal workflows where safe; no automatically unposting all existing documents.
216 +- **Starting verified live main** `d4d9e6df34f67c5f80b51daa4bb6e5512be31a8a`, protected main Quality `38518349856`, Security `38518349912`, Release Gate `38518625874`, Pages `38518677412` all SUCCESS. Current visible sale/purchase correction engines create separate physical source rows with `correctsInvoiceId` / `correctsPurchaseId` and internal numbered suffix; existing UI currently exposes these technical source versions. New user-directed correction supersedes that UX.
217 +- **Intended implementation:** change posted edit entry to in-place form prefill with deferred mutation until SAVE, use existing reversal/source-version safeguards behind the interface and invisible public history folding (one current visible version with original displayed number). Old source row and financial posting stay queryable in accounting audit. Receipt/payment allocations, external tax documents, locked periods and legacy unlinked sources remain hold cases. When full server transaction atomicity cannot be proven, fail closed and never present success before server acknowledgment; tests include open-and-cancel zero write, save+reopen, print same number, old history retained, balanced ledger, no duplicate visible rows after reload.
218 +- **No production user financial rows or Auth/RLS/SQL/schema touched; no new paid resources.** Build on isolated branch, PR-head Chromium/Golden/3 disposable PG/CodeQL, exact-main gated Pages; user acceptance remains distinct from CI.
219 +
220 ## Current change ledger
221 | 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. |
222