سامانه صدور فاکتور و حسابداری
Mirrored from https://github.com/davoodmehraban89/Factor-easy.git
Synced Dec 4, 00:30 UTC
fix(purchases): route posted purchase corrections through reversal RPC
davoodmehraban89 committed
Nov 17, 2026 at 21:54 UTC
adb2e320eed3e4105c1b3f10e5a98810f3e6935d
1 file changed
+2
-2
js/purchases.js
+2
-2
@@ -149,7 +149,7 @@
149
accountingVersion:1,documentVersion:1,correctsPurchaseId:p.id,correctsVoucherId:v.id,correctionOriginalNumber:p.number,correctionReason:why};
150
for(const k of ['journalVoucherId','accountingPostedAt','documentPostedAt','postedAt','postedBy','reversalVoucherId'])delete draft[k];
151
// This is a balanced POSTED compensating entry; the old source is not rewritten.
152
- const reversal=jeReverse(v.id,getJalaliNumeric(),why);draft.correctionReversalId=reversal.id;
152
+ const reversal=await jeRpcReverse(v.id,getJalaliNumeric(),why);draft.correctionReversalId=reversal.id;
153
datastore.purchases.push(draft);saveDatastore();
154
await invoicePilotAwaitSync(['journalVouchers|'+v.id,'journalVouchers|'+reversal.id,'purchases|'+draft.id]);
155
refreshAllSurfaces();
@@ -158,7 +158,7 @@
158
window.cancelPostedPurchasePilot=async function(id,reason){
159
const {voucher:v}=purchasePilotEligibility(id),why=String(reason||'').trim();
160
if(!why)throw new Error('دلیل ابطال الزامی است.');
161
- const reversal=jeReverse(v.id,getJalaliNumeric(),'ابطال خرید پایلوت: '+why);
161
+ const reversal=await jeRpcReverse(v.id,getJalaliNumeric(),'ابطال خرید پایلوت: '+why);
162
await invoicePilotAwaitSync(['journalVouchers|'+v.id,'journalVouchers|'+reversal.id]);
163
refreshAllSurfaces();return reversal.id;
164
};