mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 13:50:31 +00:00
fix(webapp): fix credit note and receipt auto-increment
This commit is contained in:
@@ -71,6 +71,8 @@ function MakeJournalEntriesForm({
|
||||
}
|
||||
: {
|
||||
...defaultManualJournal,
|
||||
// If the auto-increment mode is enabled, take the next journal
|
||||
// number from the settings.
|
||||
...(journalAutoIncrement && {
|
||||
journal_number: journalNumber,
|
||||
}),
|
||||
@@ -127,7 +129,6 @@ function MakeJournalEntriesForm({
|
||||
transformErrors(errors, { setErrors });
|
||||
setSubmitting(false);
|
||||
};
|
||||
|
||||
// Handle the request success.
|
||||
const handleSuccess = (errors) => {
|
||||
AppToaster.show({
|
||||
|
||||
@@ -27,6 +27,7 @@ import {
|
||||
CurrencySelectList,
|
||||
FormattedMessage as T,
|
||||
FInputGroup,
|
||||
FFormGroup,
|
||||
} from '@/components';
|
||||
import { useMakeJournalFormContext } from './MakeJournalProvider';
|
||||
import { JournalExchangeRateInputField } from './components';
|
||||
@@ -74,7 +75,7 @@ const MakeJournalTransactionNoField = R.compose(
|
||||
};
|
||||
|
||||
return (
|
||||
<FormGroup
|
||||
<FFormGroup
|
||||
name={'journal_number'}
|
||||
label={<T id={'journal_no'} />}
|
||||
labelInfo={
|
||||
@@ -91,10 +92,10 @@ const MakeJournalTransactionNoField = R.compose(
|
||||
<FInputGroup
|
||||
name={'journal_number'}
|
||||
fill={true}
|
||||
value={values.journal_number}
|
||||
asyncControl={true}
|
||||
onBlur={handleJournalNoBlur}
|
||||
fastField={true}
|
||||
onChange={() => {}}
|
||||
/>
|
||||
<InputPrependButton
|
||||
buttonProps={{
|
||||
@@ -108,7 +109,7 @@ const MakeJournalTransactionNoField = R.compose(
|
||||
}}
|
||||
/>
|
||||
</ControlGroup>
|
||||
</FormGroup>
|
||||
</FFormGroup>
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
@@ -11,8 +11,14 @@ export default function MakeJournalFormDialogs() {
|
||||
|
||||
// Update the form once the journal number form submit confirm.
|
||||
const handleConfirm = (settings) => {
|
||||
// Set the invoice transaction no. that cames from dialog to the form.
|
||||
// the `journal_number` will be empty except the increment mode is not auto.
|
||||
setFieldValue('journal_number', settings.transactionNumber);
|
||||
setFieldValue('journal_number_manually', settings.transactionNumber);
|
||||
setFieldValue('journal_number_manually', '');
|
||||
|
||||
if (settings.incrementMode !== 'auto') {
|
||||
setFieldValue('journal_number_manually', settings.transactionNumber);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -218,10 +218,13 @@ export const JournalSyncIncrementSettingsToForm = R.compose(
|
||||
const { setFieldValue } = useFormikContext();
|
||||
|
||||
useUpdateEffect(() => {
|
||||
// Do not update if the journal auto-increment mode is disabled.
|
||||
if (!journalAutoIncrement) return null;
|
||||
|
||||
const journalNo = transactionNumber(journalNumberPrefix, journalNextNumber);
|
||||
setFieldValue('journal_number', journalNo);
|
||||
setFieldValue(
|
||||
'journal_number',
|
||||
transactionNumber(journalNumberPrefix, journalNextNumber),
|
||||
);
|
||||
}, [
|
||||
setFieldValue,
|
||||
journalNumberPrefix,
|
||||
|
||||
@@ -6,7 +6,6 @@ import intl from 'react-intl-universal';
|
||||
import { Intent } from '@blueprintjs/core';
|
||||
import { sumBy, setWith, toSafeInteger, get, first } from 'lodash';
|
||||
import {
|
||||
transactionNumber,
|
||||
updateTableCell,
|
||||
repeatValue,
|
||||
transformToForm,
|
||||
@@ -46,7 +45,7 @@ export const defaultEntry = {
|
||||
|
||||
export const defaultManualJournal = {
|
||||
journal_number: '',
|
||||
journal_number_manually: false,
|
||||
journal_number_manually: '',
|
||||
journal_type: 'Journal',
|
||||
date: moment(new Date()).format('YYYY-MM-DD'),
|
||||
description: '',
|
||||
|
||||
Reference in New Issue
Block a user