@davoodmehraban89 / Factor-easy / commits / 78da6e6
Fork 0

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

fix(lifecycle): allow reposting migrated draft-linked sources

davoodmehraban89 committed Nov 18, 2026 at 09:10 UTC 78da6e61ab48d6b392ddf3a6a9e15e2233344a5b
1 file changed +3 -1
js/journal-rpc.js
+3 -1
@@ -239,7 +239,9 @@ async function jeRpcAutoPost(kind,sourceId){
239 if(!existing){await jeRpcRefresh(org);source=jeRpcSourceRecord(collection,sourceId);existing=getMyJournalVouchers().find(v=>v.id===source?.journalVoucherId);}
240 if(existing?.status==='posted'&&jeRpcEffectiveStatus(existing)!=='reversed'){delete source.accountingPostingPending;delete source.accountingPostingPendingAt;return existing;}
241 if(existing&&jeRpcEffectiveStatus(existing)==='reversed')throw new Error('سند منبع قبلاً برگشت حسابداری شده است؛ ثبت مجدد مجاز نیست.');
242 - throw new Error('رکورد منبع از قبل به سندی متصل است؛ وضعیت اتصال باید بررسی شود.');
242 + // A migrated legacy voucher is itself a draft temporary document. The server
243 + // transaction records its deletion in the lifecycle audit and creates the
244 + // new posted voucher, so the source can be finalized without manual cleanup.
245 }
246 if(!Number.isSafeInteger(Number(source.grandTotal))||Number(source.grandTotal)<=0)
247 throw new Error('مبلغ کل منبع باید عدد صحیح مثبت و امن باشد.');