سامانه صدور فاکتور و حسابداری
test: enforce source date and voucher type in autopost browser fixture
davoodmehraban89 committed
Nov 17, 2026 at 21:39 UTC
04665382ca9f98507d520c880f1c678761be592c
1 file changed
+1
scripts/accounting-document-workflow.spec.js
+1
@@ -53,6 +53,7 @@ async function installHarness(page,server){
53
const sourceRow=server.records.get(sourceKey);
54
if(!sourceRow)return {data:null,error:{message:'FINORA_SOURCE_NOT_COMMITTED_IN_ORG',code:'23503'}};
55
const kind=args.p_header.sourceType;
56
+ if(args.p_header.voucherType!==kind||args.p_header.date!==sourceRow.data.date)return {data:null,error:{message:'FINORA_SOURCE_HEADER_MISMATCH',code:'23514'}};
57
const prior=[...server.records.values()].find(row=>row.collection==='journalVouchers'&&row.data.sourceType===kind&&row.data.sourceId===args.p_source_id&&['posted','reversed'].includes(row.data.status));
58
if(prior)return {data:{voucher:{...copy(prior.data),id:prior.id,version:Number(prior.version)||1},replayed:true},error:null};
59
const amount=Number(sourceRow.data.grandTotal||0);