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

fix(accounting): preserve original reversal reason during retry recovery

davoodmehraban89 committed Nov 17, 2026 at 22:04 UTC d24dd63d01def9f39b8ad2aab8c8a1ae2e639de2
1 file changed +1 -1
js/invoices.js
+1 -1
@@ -471,7 +471,7 @@ async function reopenPostedInvoiceAsDraft(invoiceId,reason){
471 const number=invoicePilotCorrectionNumber(inv);
472 const id=afId('INV'),now=new Date().toISOString();
473 const draft={...inv,id,number,createdAt:now,updatedAt:now,documentStatus:'draft',accountingStatus:'draft',documentVersion:1,accountingVersion:1,
474 - correctsInvoiceId:inv.id,correctsVoucherId:v.id,correctionReason:why,
474 + correctsInvoiceId:inv.id,correctsVoucherId:v.id,correctionReason:String(reversal.reversalReason||why).trim(),
475 correctionOriginalNumber:inv.number};
476 for(const key of ['journalVoucherId','accountingPostedAt','documentPostedAt','documentPostedBy','postedAt','postedBy','reversalVoucherId'])delete draft[key];
477 // The reversal RPC creates the compensating voucher without mutating posted journal rows.