From fc2fac80af829946f1b4d29973eb46fdc72a24c9 Mon Sep 17 00:00:00 2001 From: Ahmed Bouhuolia Date: Wed, 16 Oct 2024 20:12:25 +0200 Subject: [PATCH] fix: Sync account normal of cashflow GL entries --- .../Cashflow/CashflowTransactionJournalEntries.ts | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/packages/server/src/services/Cashflow/CashflowTransactionJournalEntries.ts b/packages/server/src/services/Cashflow/CashflowTransactionJournalEntries.ts index 55ba10563..62bf35992 100644 --- a/packages/server/src/services/Cashflow/CashflowTransactionJournalEntries.ts +++ b/packages/server/src/services/Cashflow/CashflowTransactionJournalEntries.ts @@ -1,14 +1,7 @@ import { Inject, Service } from 'typedi'; import { Knex } from 'knex'; -import { - ILedgerEntry, - ICashflowTransaction, - AccountNormal, -} from '../../interfaces'; -import { - transformCashflowTransactionType, - getCashflowAccountTransactionsTypes, -} from './utils'; +import { ILedgerEntry, ICashflowTransaction } from '../../interfaces'; +import { transformCashflowTransactionType } from './utils'; import LedgerStorageService from '@/services/Accounting/LedgerStorageService'; import Ledger from '@/services/Accounting/Ledger'; import HasTenancyService from '@/services/Tenancy/TenancyService'; @@ -70,7 +63,7 @@ export default class CashflowTransactionJournalEntries { debit: cashflowTransaction.isCashDebit ? cashflowTransaction.localAmount : 0, - accountNormal: AccountNormal.DEBIT, + accountNormal: cashflowTransaction?.cashflowAccount?.accountNormal, index: 1, }; }; @@ -143,6 +136,7 @@ export default class CashflowTransactionJournalEntries { // Retrieves the cashflow transactions with associated entries. const transaction = await CashflowTransaction.query(trx) .findById(cashflowTransactionId) + .withGraphFetched('cashflowAccount') .withGraphFetched('creditAccount'); // Retrieves the cashflow transaction ledger.