Skip to content

Commit

Permalink
Merge pull request #318 from bigcapitalhq/big-120-get-cashflow-transa…
Browse files Browse the repository at this point in the history
…ction-broken-cause-transaction-type

fix: `BIG-120` get cashflow transaction broken cause transaction type
  • Loading branch information
abouolia authored Jan 20, 2024
2 parents f03d011 + df38f88 commit 3df1739
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 6 deletions.
9 changes: 7 additions & 2 deletions packages/server/src/models/CashflowTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@ import {
} from '@/services/Cashflow/utils';
import AccountTransaction from './AccountTransaction';
import { CASHFLOW_DIRECTION } from '@/services/Cashflow/constants';

import { getTransactionTypeLabel } from '@/utils/transactions-types';
export default class CashflowTransaction extends TenantModel {
transactionType: string;
amount: number;
exchangeRate: number;

/**
* Table name.
*/
Expand Down Expand Up @@ -55,9 +59,10 @@ export default class CashflowTransaction extends TenantModel {

/**
* Transaction type formatted.
* @returns {string}
*/
get transactionTypeFormatted() {
return AccountTransaction.getReferenceTypeFormatted(this.transactionType);
return getTransactionTypeLabel(this.transactionType);
}

get typeMeta() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// @ts-nocheck
import React from 'react';
import { MoneyInDialogProvider } from './MoneyInDialogProvider';
import MoneyInForm from './MoneyInForm';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ function MoneyInForm({
};

// Handles the form submit.
const handleFormSubmit = (values, { setSubmitting, setErrors }) => {
const handleFormSubmit = (values, { setSubmitting }) => {
const form = {
...omit(values, ['currency_code']),
publish: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ function MoneyOutForm({
accountId,
accountType,
createCashflowTransactionMutate,
submitPayload,
} = useMoneyOutDialogContext();

// transaction number.
Expand Down
1 change: 1 addition & 0 deletions packages/webapp/src/containers/CashFlow/_components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { useUpdateEffect } from '@/hooks';

import withSettings from '@/containers/Settings/withSettings';
import withDialogActions from '@/containers/Dialog/withDialogActions';
import { transactionNumber } from '@/utils';

/**
* Syncs cashflow auto-increment settings to the form once update.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import ReferenceNumberForm from '@/containers/JournalNumber/ReferenceNumberForm'
import withDialogActions from '@/containers/Dialog/withDialogActions';
import withSettings from '@/containers/Settings/withSettings';
import withSettingsActions from '@/containers/Settings/withSettingsActions';
import { compose } from '@/utils';
import {
transformFormToSettings,
transformSettingsToForm,
} from '@/containers/JournalNumber/utils';
import { compose } from '@/utils';

/**
* Transaction number dialog content.
Expand Down
3 changes: 3 additions & 0 deletions packages/webapp/src/hooks/query/cashflowAccounts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import useApiRequest from '../useRequest';
import t from './types';

const commonInvalidateQueries = (queryClient) => {
// Invalidate settings.
queryClient.invalidateQueries([t.SETTING, t.SETTING_CASHFLOW]);

// Invalidate accounts.
queryClient.invalidateQueries(t.ACCOUNTS);
queryClient.invalidateQueries(t.ACCOUNT);
Expand Down

0 comments on commit 3df1739

Please sign in to comment.