Merge pull request #524 from bigcapitalhq/fix-cashflow-transactions-type

fix: Cashflow transactions types
This commit is contained in:
Ahmed Bouhuolia
2024-07-09 14:57:43 +02:00
committed by GitHub
7 changed files with 113 additions and 25 deletions

View File

@@ -10,6 +10,7 @@ export default class AccountTransaction extends TenantModel {
debit: number;
exchangeRate: number;
taxRate: number;
transactionType: string;
/**
* Table name
@@ -53,7 +54,7 @@ export default class AccountTransaction extends TenantModel {
* @return {string}
*/
get referenceTypeFormatted() {
return getTransactionTypeLabel(this.referenceType);
return getTransactionTypeLabel(this.referenceType, this.transactionType);
}
/**

View File

@@ -6,7 +6,7 @@ import {
getCashflowTransactionType,
} from '@/services/Cashflow/utils';
import { CASHFLOW_DIRECTION } from '@/services/Cashflow/constants';
import { getTransactionTypeLabel } from '@/utils/transactions-types';
import { getCashflowTransactionFormattedType } from '@/utils/transactions-types';
export default class CashflowTransaction extends TenantModel {
transactionType: string;
@@ -64,7 +64,7 @@ export default class CashflowTransaction extends TenantModel {
* @returns {string}
*/
get transactionTypeFormatted() {
return getTransactionTypeLabel(this.transactionType);
return getCashflowTransactionFormattedType(this.transactionType);
}
get typeMeta() {
@@ -159,8 +159,7 @@ export default class CashflowTransaction extends TenantModel {
to: 'accounts_transactions.referenceId',
},
filter(builder) {
const referenceTypes = getCashflowAccountTransactionsTypes();
builder.whereIn('reference_type', referenceTypes);
builder.where('reference_type', 'CashflowTransaction');
},
},