فینورا پرو - سامانه جامع حسابداری و صدور فاکتور
fix(A02): return imbalance diagnostics from preview instead of throwing early
davoodmehraban89 committed
Oct 16, 2026 at 16:57 UTC
ef4ed86df2b3ecf875a4a2e3a5f53015b67a3706
1 file changed
+6
-1
src/core/OpeningBalanceService.js
+6
-1
@@ -92,11 +92,16 @@ async function examine(tx, companyId, input) {
92
}
93
// All chart rules are enforced even for readonly preview. This rejects
94
// inactive accounts, group parents, out-of-period dates and overflow.
95
+ // A dry-run should explain an unbalanced opening journal rather than
96
+ // throwing before the user can see the specific discrepancy. Keep all
97
+ // account/date/amount validations; only defer the balance requirement.
98
const validated = validateJournal({
99
companyId, date: input.openingDate, lines: (input.lines || []).map(row => ({
100
accountId: row.accountId, debit: row.debit, credit: row.credit
101
}))
99
- }, accounts, period);
102
+ }, accounts, period, {
103
+ requireBalance: !problems.includes('UNBALANCED_OPENING_JOURNAL')
104
+ });
105
if (validated.debit !== report.journal.debit ||
106
validated.credit !== report.journal.credit) {
107
throw Error('گزارش افتتاحیه با سطرهای سند مطابقت ندارد');