سامانه صدور فاکتور و حسابداری
Mirrored from https://github.com/davoodmehraban89/Factor-easy.git
Synced Dec 3, 20:45 UTC
fix(ui): retain explicit pending-post freeze invariant for linked drafts
davoodmehraban89 committed
Nov 22, 2026 at 16:53 UTC
58debcf703371771d862fc9c20838c3c447e64a1
1 file changed
+5
-3
js/invoices.js
+5
-3
@@ -384,10 +384,12 @@ function invoiceDocumentStatusLabel(inv){
384
return ({posted:'قطعی',draft:'پیشنویس قابل ویرایش',reversed:'برگشتشده',legacy_review:'قدیمی — نیازمند تطبیق',operational:'سند عملیاتی',unknown:'نامشخص'})[invoiceDocumentStatus(inv)]||'نامشخص';
385
}
386
function invoiceMayEdit(inv){
387
- if(!inv||inv.accountingPostingPending)return false;
387
+ if(!inv)return false;
388
const status=invoiceDocumentStatus(inv);
389
- // Do not allow business-only edits when a linked accounting draft must be updated atomically.
390
- return (status==='draft'||status==='operational')&&!(status==='draft'&&inv.journalVoucherId);
389
+ // Preserve the explicit pending-post freeze; also disallow source-only edits
390
+ // when a linked draft needs a future atomic server update.
391
+ return !inv.accountingPostingPending &&
392
+ (status==='draft'||status==='operational')&&!(status==='draft'&&inv.journalVoucherId);
393
}
394
async function finalizeInvoiceDocument(invoiceId){
395
if(!requireWrite()||!currentUser)throw new Error('مجوز قطعیسازی ندارید.');