BC-4: feat: base currency withCurrentOrganization

This commit is contained in:
elforjani3
2021-09-07 00:16:46 +02:00
parent 6401692903
commit 39ba31a842
31 changed files with 152 additions and 213 deletions

View File

@@ -15,6 +15,8 @@ import PaymentMadeFormBody from './PaymentMadeFormBody';
import { PaymentMadeInnerProvider } from './PaymentMadeInnerProvider';
import withSettings from 'containers/Settings/withSettings';
import withCurrentOrganization from 'containers/Organization/withCurrentOrganization';
import {
EditPaymentMadeFormSchema,
CreatePaymentMadeFormSchema,
@@ -29,7 +31,9 @@ import { defaultPaymentMade, transformToEditForm, ERRORS } from './utils';
function PaymentMadeForm({
// #withSettings
preferredPaymentAccount,
baseCurrency,
// #withCurrentOrganization
organization: { base_currency },
}) {
const history = useHistory();
@@ -54,7 +58,7 @@ function PaymentMadeForm({
: {
...defaultPaymentMade,
payment_account_id: defaultTo(preferredPaymentAccount),
currency_code: baseCurrency,
currency_code: base_currency,
entries: orderingLinesIndexes(defaultPaymentMade.entries),
}),
}),
@@ -156,10 +160,10 @@ function PaymentMadeForm({
}
export default compose(
withSettings(({ billPaymentSettings, organizationSettings }) => ({
withSettings(({ billPaymentSettings }) => ({
paymentNextNumber: billPaymentSettings?.next_number,
paymentNumberPrefix: billPaymentSettings?.number_prefix,
preferredPaymentAccount: parseInt(billPaymentSettings?.withdrawalAccount),
baseCurrency: organizationSettings?.baseCurrency,
})),
withCurrentOrganization(),
)(PaymentMadeForm);