fix(webapp): payment receive auto-increment

This commit is contained in:
a.bouhuolia
2023-05-26 00:02:47 +02:00
parent e92c4486aa
commit c90ffed67f
10 changed files with 57 additions and 18 deletions

View File

@@ -17,7 +17,6 @@ import {
} from '@/utils';
import { useCurrentOrganization } from '@/hooks/state';
// Default payment receive entry.
export const defaultPaymentReceiveEntry = {
index: '',
@@ -37,8 +36,10 @@ export const defaultPaymentReceive = {
payment_date: moment(new Date()).format('YYYY-MM-DD'),
reference_no: '',
payment_receive_no: '',
// Holds the payment number that entered manually only.
payment_receive_no_manually: '',
statement: '',
full_amount: '',
full_amount: '',
currency_code: '',
branch_id: '',
exchange_rate: 1,
@@ -156,6 +157,8 @@ export const transformFormToRequest = (form) => {
return {
...omit(form, ['payment_receive_no_manually', 'payment_receive_no']),
// The `payment_receive_no_manually` will be presented just if the auto-increment
// is disable, always both attributes hold the same value in manual mode.
...(form.payment_receive_no_manually && {
payment_receive_no: form.payment_receive_no,
}),
@@ -252,3 +255,13 @@ export const useEstimateIsForeignCustomer = () => {
);
return isForeignCustomer;
};
export const resetFormState = ({ initialValues, values, resetForm }) => {
resetForm({
values: {
// Reset the all values except the brand id.
...initialValues,
brand_id: values.brand_id,
},
});
};