سامانه صدور فاکتور و حسابداری
fix(accounting): persist source before creating linked draft
davoodmehraban89 committed
Nov 18, 2026 at 09:05 UTC
41fc083528e881932a48f2927c197ed453a53b6e
1 file changed
+1
-1
js/journal-rpc.js
+1
-1
@@ -231,7 +231,7 @@ async function jeRpcCreateSourceDraft(kind,sourceId){
231
if(!fy||fy.status==='locked')throw new Error('سال مالی باز برای تاریخ منبع پیدا نشد.');
232
const sourceVersion=Number(source.accountingVersion||1);
233
if(!Number.isSafeInteger(sourceVersion)||sourceVersion<1)throw new Error('نسخه منبع معتبر نیست.');
234
- const voucherId=source.journalVoucherId||afId('JV');
234
+ if(!source.journalVoucherId){await jeRpcPersistSourceRecord(collection,sourceId);source=jeRpcSourceRecord(collection,sourceId);}\n const voucherId=source.journalVoucherId||afId('JV');
235
const header={
236
companyId:source.companyId,fiscalYearId:fy.id,date,
237
description:String(source.description||((kind==='sale'?'فروش ':'خرید ')+(source.number||source.id))),