@davoodmehraban89 / Factor-easy-2 Mirror · read-only / commits / 4ee9fbf
Fork 0

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

Mirrored from https://github.com/davoodmehraban89/Factor-easy.git

Synced Dec 4, 04:15 UTC

docs(ux): record deferred in-place document correction implementation and validation gates

davoodmehraban89 committed Oct 14, 2026 at 09:48 UTC 4ee9fbf0a245a36421deae29ead675fec4d9d200
1 file changed +6
PROJECT_STATE.md
+6
@@ -217,6 +217,12 @@ The latest user message is the sole source of new instructions. Read AGENTS.md t
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 +### 2026-10-14 Same-document correction UX implementation checkpoint — PR QA PENDING
221 +- **Implemented on isolated branch:** `js/invoices.js` uses `invoiceVisibleRecords` / `invoiceVisibleNumber` to fold internal version chain and show one active business invoice under the original number; `beginInvoiceAmendment` opens the existing posted invoice's **same edit form** with zero accounting mutations until Save. Save privately creates linked compensating posting and corrected source, persists edited data, re-posts and confirms server sync. `js/purchases.js` implements same in-form deferred purchase correction, one logical purchase record and original supplier number, while preserving payment/stock/period restrictions. `js/document-management.js` renders one sale and purchase row per logical invoice, and `js/print.js` prints corrected sale content with original number; purchase print follows current active revision and original supplier number. Existing journal audit displays original/reversal/new source-linked postings.
222 +- **No user-visible correction suffix, new invoice message or internal journal prompt** on normal posted→edit form workflow; editing can be cancelled without reversal. Original source data and posted voucher/lines remain physically unchanged. This design still stores internal technical source revisions, distinct from a user-visible business document ID; genuine single-row storage requires a separately approved schema redesign.
223 +- **Automated test coverage added:** 2 browser journeys for posted sale and purchase: click same document→cancel=no write→reopen→edit→single Save→internal reversal/repost→single visible item, same printed number, original transaction unchanged, reload consistency. **5/5 V8 syntax PASS**. Full Chromium/Golden/3 DB/CodeQL and exact-main Pages: PENDING; do not merge if any gate fails.
224 +- **Caveats:** source amendment is currently a multi-step application sync (not a server transaction) and waits for acknowledged stages; fail closed on sync trouble and do not retry blindly. Do not edit production historical customer records for testing; owner sign-in & UI acceptance remain OPEN. Payment/expense/tax source families remain unimplemented.
225 +
226 ## Current change ledger
227 | 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. |
228