diff --git a/client/src/containers/Expenses/ExpenseForm.js b/client/src/containers/Expenses/ExpenseForm.js index f319d0386..f5543642a 100644 --- a/client/src/containers/Expenses/ExpenseForm.js +++ b/client/src/containers/Expenses/ExpenseForm.js @@ -56,13 +56,13 @@ function ExpenseForm({ // #withSettings baseCurrency, + preferredPaymentAccount, // #own Props expenseId, onFormSubmit, onCancelForm, }) { - const [payload, setPayload] = useState({}); const history = useHistory(); @@ -148,7 +148,7 @@ function ExpenseForm({ const defaultInitialValues = useMemo( () => ({ - payment_account_id: '', + payment_account_id: parseInt(preferredPaymentAccount), beneficiary: '', payment_date: moment(new Date()).format('YYYY-MM-DD'), description: '', @@ -410,7 +410,8 @@ export default compose( withDashboardActions, withMediaActions, withExpenseDetail(), - withSettings(({ organizationSettings }) => ({ + withSettings(({ organizationSettings, expenseSettings }) => ({ baseCurrency: organizationSettings?.baseCurrency, + preferredPaymentAccount: expenseSettings?.preferredPaymentAccount, })), )(ExpenseForm); diff --git a/client/src/containers/Settings/withSettings.js b/client/src/containers/Settings/withSettings.js index 68588c579..d775e9c43 100644 --- a/client/src/containers/Settings/withSettings.js +++ b/client/src/containers/Settings/withSettings.js @@ -11,6 +11,7 @@ export default (mapState) => { receiptSettings: state.settings.data.salesReceipts, invoiceSettings: state.settings.data.salesInvoices, itemsSettings: state.settings.data.items, + expenseSettings: state.settings.data.expenses, }; return mapState ? mapState(mapped, state, props) : mapped; }; diff --git a/server/src/data/options.js b/server/src/data/options.js index 1f369748d..ff9149027 100644 --- a/server/src/data/options.js +++ b/server/src/data/options.js @@ -92,6 +92,10 @@ export default { key: "number_prefix", type: "string", }, + { + key: "preferred_deposit_account", + type: "number", + }, ], sales_invoices: [ { @@ -127,4 +131,10 @@ export default { type: "number", }, ], + expenses: [ + { + key: "preferred_payment_account", + type: "number", + }, + ], };