@davoodmehraban89 / Factor-easy / commits / 9e62345
Fork 0

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

fix(treasury): show amendment only for supported noncheque instruments and refresh manager after server acknowledgment

davoodmehraban89 committed Oct 14, 2026 at 10:59 UTC 9e62345d3788929a1acffacfddfdd4acfc1307ca
1 file changed +4 -3
js/payments.js
+4 -3
@@ -32,7 +32,7 @@ function paymentEffectiveRecords(){
32 return paymentVisibleRecords().filter(p=>['posted','legacy_review'].includes(paymentPostingStatus(p)));
33 }
34 function paymentCanAmend(p){
35 - return !!p&&!p.invoiceId&&!p.invoiceType&&p.method!=='cheque';
35 + return !!p&&!p.invoiceId&&!p.invoiceType&&['cash','bank','card'].includes(p.method);
36 }
37 function paymentEligibility(id){
38 if(!requireWrite()||!currentUser)throw new Error('مجوز اصلاح دریافت/پرداخت ندارید.');
@@ -125,9 +125,10 @@ function cancelPostedPaymentUi(id){
125 if(!confirm('فقط ثبت داخل فینورا با سند حسابداری معکوس ابطال می‌شود. تراکنش واقعی بانک/کارت برگشت نمی‌خورد. ادامه می‌دهید؟'))return;
126 const reason=prompt('دلیل ابطال ثبت نرم‌افزاری:','اشتباه ثبت در دوره پایلوت');
127 if(reason===null)return;
128 - void paymentCancelPosted(id,reason).then(()=>{refreshAllSurfaces();renderPayments();alert('ابطال ثبت شد. سابقه اصلی محفوظ است.');})
128 + void paymentCancelPosted(id,reason).then(()=>{refreshAllSurfaces();renderPayments();if(typeof renderDocumentManagement==='function')renderDocumentManagement();alert('ابطال ثبت شد. سابقه اصلی محفوظ است.');})
129 .catch(e=>{refreshAllSurfaces();renderPayments();alert('ابطال تأیید نشد؛ وضعیت سرور را قبل از تکرار بررسی کنید: '+e.message);});
130 }
131 +window.paymentCanAmend=paymentCanAmend;
132 window.paymentVisibleRecords=paymentVisibleRecords;
133 window.paymentEffectiveRecords=paymentEffectiveRecords;
134 window.paymentPostingStatus=paymentPostingStatus;
@@ -195,7 +196,7 @@ function commitSavePayment(){
196 try{paymentEligibility(id);paymentPreflight(payload,old);}catch(e){alert(e.message);return;}
197 const btn=document.getElementById('pay-save');if(btn)btn.disabled=true;
198 void paymentAmendPosted(id,payload).then(()=>{
198 - resetPaymentForm();refreshAllSurfaces();renderPayments();
199 + resetPaymentForm();refreshAllSurfaces();renderPayments();if(typeof renderDocumentManagement==='function')renderDocumentManagement();
200 alert('اصلاح دریافت/پرداخت ذخیره شد.');
201 }).catch(e=>{
202 resetPaymentForm();refreshAllSurfaces();renderPayments();