Fix : Connect default payment account with Expenses

This commit is contained in:
elforjani3
2020-11-16 20:00:45 +02:00
parent f3bcde5b53
commit 805d789afd
3 changed files with 15 additions and 3 deletions

View File

@@ -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);