سامانه صدور فاکتور و حسابداری
fix(accounting): preserve original reversal reason during retry recovery
davoodmehraban89 committed
Nov 17, 2026 at 22:04 UTC
2e4c579b675e73bf8272ab0b46a0ff87883c2ca3
1 file changed
+1
-1
js/purchases.js
+1
-1
@@ -161,7 +161,7 @@
161
}
162
const number=purchasePilotNumber(p),now=new Date().toISOString(),newId=afId('PUR');
163
const draft={...p,id:newId,number,date:getJalaliNumeric(),documentStatus:'draft',accountingStatus:'draft',createdAt:now,updatedAt:now,
164
- accountingVersion:1,documentVersion:1,correctsPurchaseId:p.id,correctsVoucherId:v.id,correctionOriginalNumber:p.number,correctionReason:why};
164
+ accountingVersion:1,documentVersion:1,correctsPurchaseId:p.id,correctsVoucherId:v.id,correctionOriginalNumber:p.number,correctionReason:String(reversal.reversalReason||why).trim()};
165
for(const k of ['journalVoucherId','accountingPostedAt','documentPostedAt','postedAt','postedBy','reversalVoucherId'])delete draft[k];
166
// This is a balanced POSTED compensating entry; the old source is not rewritten.
167
const reversal=await jeRpcReverse(v.id,getJalaliNumeric(),why);draft.correctionReversalId=reversal.id;