فینورا پرو - سامانه جامع حسابداری و صدور فاکتور

fix(A01): forbid automatic cash movements during return invoices

davoodmehraban89 committed Oct 14, 2026 at 23:33 UTC 1885e772c8053f2606d54bd664cd3d7a22876e49
1 file changed +6
src/core/RetailPostingService.js
+6
@@ -215,6 +215,12 @@ class RetailPostingServiceImpl {
215 const company=await DataScope.companyId();
216 if(!await this.isEnabled())throw Error('حسابداری یکپارچه برای این شرکت فعال نیست');
217 assertInvoiceTotals(invoice);
218 + // A return is a new commercial/ledger document, not authorization for
219 + // an automatic bank withdrawal or supplier receipt. The payment requires
220 + // a separate explicitly approved treasury operation.
221 + if(['sale_return','purchase_return'].includes(invoice.kind) && invoice.paidAmount > 0) {
222 + throw Error('استرداد یا دریافت وجه مرجوعی باید با سند مستقل خزانه ثبت و تأیید شود');
223 + }
224 if(invoice.isPreInvoice)throw Error('پیش‌فاکتور نباید سند مالی تولید کند');
225 if(!invoice.id)throw Error('شناسه یکتای فاکتور الزامی است');
226 return StorageService.transaction(FINANCE_STORES,async tx=>{