diff --git a/packages/server/src/services/Expenses/CRUD/CommandExpenseValidator.ts b/packages/server/src/services/Expenses/CRUD/CommandExpenseValidator.ts
index 4e71b6ce3..ca3f74073 100644
--- a/packages/server/src/services/Expenses/CRUD/CommandExpenseValidator.ts
+++ b/packages/server/src/services/Expenses/CRUD/CommandExpenseValidator.ts
@@ -1,7 +1,7 @@
import { Service, Inject } from 'typedi';
import { sumBy, difference } from 'lodash';
import { ServiceError } from '@/exceptions';
-import { ERRORS } from '../constants';
+import { ERRORS, SUPPORTED_EXPENSE_PAYMENT_ACCOUNT_TYPES } from '../constants';
import {
IAccount,
IExpense,
@@ -79,7 +79,9 @@ export class CommandExpenseValidator {
* @throws {ServiceError}
*/
public validatePaymentAccountType = (paymentAccount: number[]) => {
- if (!paymentAccount.isParentType(ACCOUNT_PARENT_TYPE.CURRENT_ASSET)) {
+ if (
+ !paymentAccount.isAccountType(SUPPORTED_EXPENSE_PAYMENT_ACCOUNT_TYPES)
+ ) {
throw new ServiceError(ERRORS.PAYMENT_ACCOUNT_HAS_INVALID_TYPE);
}
};
diff --git a/packages/server/src/services/Expenses/constants.ts b/packages/server/src/services/Expenses/constants.ts
index 69144e065..4067b7fd4 100644
--- a/packages/server/src/services/Expenses/constants.ts
+++ b/packages/server/src/services/Expenses/constants.ts
@@ -1,3 +1,5 @@
+import { ACCOUNT_TYPE } from '@/data/AccountTypes';
+
export const DEFAULT_VIEW_COLUMNS = [];
export const DEFAULT_VIEWS = [
{
@@ -76,3 +78,12 @@ export const ExpensesSampleData = [
Publish: 'T',
},
];
+
+export const SUPPORTED_EXPENSE_PAYMENT_ACCOUNT_TYPES = [
+ ACCOUNT_TYPE.CASH,
+ ACCOUNT_TYPE.BANK,
+ ACCOUNT_TYPE.CREDIT_CARD,
+ ACCOUNT_TYPE.OTHER_CURRENT_ASSET,
+ ACCOUNT_TYPE.NON_CURRENT_ASSET,
+ ACCOUNT_TYPE.FIXED_ASSET,
+];
diff --git a/packages/webapp/src/containers/Expenses/ExpenseForm/ExpenseFormHeaderFields.tsx b/packages/webapp/src/containers/Expenses/ExpenseForm/ExpenseFormHeaderFields.tsx
index 067bcda94..b5c4ffb69 100644
--- a/packages/webapp/src/containers/Expenses/ExpenseForm/ExpenseFormHeaderFields.tsx
+++ b/packages/webapp/src/containers/Expenses/ExpenseForm/ExpenseFormHeaderFields.tsx
@@ -1,9 +1,9 @@
// @ts-nocheck
import React from 'react';
-import { InputGroup, FormGroup, Position, Classes } from '@blueprintjs/core';
+import { FormGroup, Position, Classes } from '@blueprintjs/core';
import { DateInput } from '@blueprintjs/datetime';
import { FastField, ErrorMessage } from 'formik';
-import { CustomersSelect, FormattedMessage as T } from '@/components';
+import { CustomersSelect, FInputGroup, FormattedMessage as T } from '@/components';
import classNames from 'classnames';
import { CLASSES } from '@/constants/classes';
import {
@@ -15,15 +15,14 @@ import {
import { customersFieldShouldUpdate, accountsFieldShouldUpdate } from './utils';
import {
CurrencySelectList,
- CustomerSelectField,
FFormGroup,
AccountsSelect,
FieldRequiredHint,
Hint,
} from '@/components';
import { ExpensesExchangeRateInputField } from './components';
-import { ACCOUNT_PARENT_TYPE } from '@/constants/accountTypes';
import { useExpenseFormContext } from './ExpenseFormPageProvider';
+import { SUPPORTED_EXPENSE_PAYMENT_ACCOUNT_TYPES } from './constants';
/**
* Expense form header.
@@ -68,7 +67,7 @@ export default function ExpenseFormHeader() {
name={'payment_account_id'}
items={accounts}
placeholder={}
- filterByParentTypes={[ACCOUNT_PARENT_TYPE.CURRENT_ASSET]}
+ filterByTypes={SUPPORTED_EXPENSE_PAYMENT_ACCOUNT_TYPES}
allowCreate={true}
fastField={true}
shouldUpdate={accountsFieldShouldUpdate}
@@ -107,19 +106,15 @@ export default function ExpenseFormHeader() {
formGroupProps={{ label: ' ', inline: true }}
/>
-
- {({ form, field, meta: { error, touched } }) => (
- }
- className={classNames('form-group--ref_no', Classes.FILL)}
- intent={inputIntent({ error, touched })}
- helperText={}
- inline={true}
- >
-
-
- )}
-
+ {/* ----------- Reference No. ----------- */}
+ }
+ inline={true}
+ fastField
+ >
+
+
{/* ----------- Customer ----------- */}
diff --git a/packages/webapp/src/containers/Expenses/ExpenseForm/constants.ts b/packages/webapp/src/containers/Expenses/ExpenseForm/constants.ts
new file mode 100644
index 000000000..abe3ff297
--- /dev/null
+++ b/packages/webapp/src/containers/Expenses/ExpenseForm/constants.ts
@@ -0,0 +1,10 @@
+import { ACCOUNT_TYPE } from "@/constants";
+
+export const SUPPORTED_EXPENSE_PAYMENT_ACCOUNT_TYPES = [
+ ACCOUNT_TYPE.CASH,
+ ACCOUNT_TYPE.BANK,
+ ACCOUNT_TYPE.CREDIT_CARD,
+ ACCOUNT_TYPE.OTHER_CURRENT_ASSET,
+ ACCOUNT_TYPE.NON_CURRENT_ASSET,
+ ACCOUNT_TYPE.FIXED_ASSET,
+];