Merge pull request #715 from bigcapitalhq/sync-account-norma-cashflow

fix: Sync account normal of cashflow GL entries
This commit is contained in:
Ahmed Bouhuolia
2024-10-16 20:12:51 +02:00
committed by GitHub

View File

@@ -1,14 +1,7 @@
import { Inject, Service } from 'typedi'; import { Inject, Service } from 'typedi';
import { Knex } from 'knex'; import { Knex } from 'knex';
import { import { ILedgerEntry, ICashflowTransaction } from '../../interfaces';
ILedgerEntry, import { transformCashflowTransactionType } from './utils';
ICashflowTransaction,
AccountNormal,
} from '../../interfaces';
import {
transformCashflowTransactionType,
getCashflowAccountTransactionsTypes,
} from './utils';
import LedgerStorageService from '@/services/Accounting/LedgerStorageService'; import LedgerStorageService from '@/services/Accounting/LedgerStorageService';
import Ledger from '@/services/Accounting/Ledger'; import Ledger from '@/services/Accounting/Ledger';
import HasTenancyService from '@/services/Tenancy/TenancyService'; import HasTenancyService from '@/services/Tenancy/TenancyService';
@@ -70,7 +63,7 @@ export default class CashflowTransactionJournalEntries {
debit: cashflowTransaction.isCashDebit debit: cashflowTransaction.isCashDebit
? cashflowTransaction.localAmount ? cashflowTransaction.localAmount
: 0, : 0,
accountNormal: AccountNormal.DEBIT, accountNormal: cashflowTransaction?.cashflowAccount?.accountNormal,
index: 1, index: 1,
}; };
}; };
@@ -143,6 +136,7 @@ export default class CashflowTransactionJournalEntries {
// Retrieves the cashflow transactions with associated entries. // Retrieves the cashflow transactions with associated entries.
const transaction = await CashflowTransaction.query(trx) const transaction = await CashflowTransaction.query(trx)
.findById(cashflowTransactionId) .findById(cashflowTransactionId)
.withGraphFetched('cashflowAccount')
.withGraphFetched('creditAccount'); .withGraphFetched('creditAccount');
// Retrieves the cashflow transaction ledger. // Retrieves the cashflow transaction ledger.