فینورا پرو - سامانه جامع حسابداری و صدور فاکتور
fix(A02): return missing-lines issue for empty opening file preflight
davoodmehraban89 committed
Oct 16, 2026 at 16:58 UTC
8e3d4985ce675470dd02fd1c0aca8e2c5667b5ef
1 file changed
+10
-7
src/core/OpeningBalanceService.js
+10
-7
@@ -95,13 +95,16 @@ async function examine(tx, companyId, input) {
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
- }))
102
- }, accounts, period, {
103
- requireBalance: !problems.includes('UNBALANCED_OPENING_JOURNAL')
104
- });
98
+ const validated = input.lines.length
99
+ ? validateJournal({
100
+ companyId, date: input.openingDate, lines: input.lines.map(row => ({
101
+ accountId: row.accountId, debit: row.debit, credit: row.credit
102
+ }))
103
+ }, accounts, period, {
104
+ requireBalance: !problems.includes('UNBALANCED_OPENING_JOURNAL')
105
+ })
106
+ // An empty data-file is a blocked preview, not a failed posting attempt.
107
+ : { ...report.journal };
108
if (validated.debit !== report.journal.debit ||
109
validated.credit !== report.journal.credit) {
110
throw Error('گزارش افتتاحیه با سطرهای سند مطابقت ندارد');