سامانه صدور فاکتور و حسابداری
feat(lifecycle): enforce draft-first source lifecycle and cascade deletion
davoodmehraban89 committed
Nov 18, 2026 at 09:03 UTC
719fc23db37fe6070fcd3623cc9679ccf2800a8e
1 file changed
+4
-3
js/invoices.js
+4
-3
@@ -368,8 +368,9 @@ function invoiceDocumentStatus(inv){
368
if(!inv)return 'unknown';
369
const linked=inv.journalVoucherId&&typeof jeSourceVoucher==='function'?jeSourceVoucher(inv):null;
370
if(linked?.status==='reversed'||inv.accountingStatus==='reversed'||inv.documentStatus==='reversed')return 'reversed';
371
- if(linked?.status==='posted'||inv.journalVoucherId||inv.accountingStatus==='posted'||inv.documentStatus==='posted')return 'posted';
372
- if(inv.documentStatus==='draft'||inv.accountingStatus==='draft')return 'draft';
371
+ if(linked?.status==='posted')return 'posted';
372
+ if(linked?.status==='draft'||inv.documentStatus==='draft'||inv.accountingStatus==='draft')return 'draft';
373
+ if(inv.journalVoucherId||inv.accountingStatus==='posted'||inv.documentStatus==='posted')return 'posted';
374
if(invoiceCreatesAccountingEntry(inv.kind))return 'legacy_review';
375
return 'operational';
376
}
@@ -734,4 +735,4 @@ function renderInvoices(){
735
}
736
737
function finoraEnsureInitialInvoiceRow(){const body=document.getElementById('invoice-items-table-body');if(body&&!body.querySelector('tr')&&!document.getElementById('edit-invoice-id')?.value)addInvoiceItemRow()}
737
-if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',finoraEnsureInitialInvoiceRow,{once:true});else finoraEnsureInitialInvoiceRow();
738
+if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',finoraEnsureInitialInvoiceRow,{once:true});else finoraEnsureInitialInvoiceRow();
\ No newline at end of file