feat(Sales & Purchases ): add setfieldvalue exchange rate.

This commit is contained in:
elforjani13
2022-02-23 12:22:27 +02:00
parent cf7d032aae
commit e6a7c7bc58
26 changed files with 118 additions and 66 deletions

View File

@@ -54,8 +54,14 @@ function ReceiptFormHeader({
receiptNextNumber,
receiptNumberPrefix,
}) {
const { accounts, customers, isForeignCustomer, setSelectCustomer } =
useReceiptFormContext();
const {
accounts,
customers,
isForeignCustomer,
baseCurrency,
selectCustomer,
setSelectCustomer,
} = useReceiptFormContext();
const handleReceiptNumberChange = useCallback(() => {
openDialog('receipt-number-form', {});
@@ -101,6 +107,7 @@ function ReceiptFormHeader({
defaultSelectText={<T id={'select_customer_account'} />}
onContactSelected={(customer) => {
form.setFieldValue('customer_id', customer.id);
form.setFieldValue('exchange_rate', '');
setSelectCustomer(customer);
}}
popoverFill={true}
@@ -115,8 +122,8 @@ function ReceiptFormHeader({
{/* ----------- Exchange rate ----------- */}
<If condition={isForeignCustomer}>
<ExchangeRateInputGroup
fromCurrency={'USD'}
toCurrency={'LYD'}
fromCurrency={baseCurrency}
toCurrency={selectCustomer?.currency_code}
name={'exchange_rate'}
formGroupProps={{ label: ' ', inline: true }}
/>