fix(server): refund credit note gl entries

This commit is contained in:
Ahmed Bouhuolia
2026-01-08 00:27:43 +02:00
parent 9b3f6b22d1
commit e063597a80
8 changed files with 237 additions and 165 deletions

View File

@@ -6,7 +6,7 @@ import { Intent, Alert } from '@blueprintjs/core';
import { queryCache } from 'react-query';
import { AppToaster } from '@/components';
import { withAccountsActions } from '@/containers/Accounts/withAccountsTableActions';
// import { withAccountsActions } from '@/containers/Accounts/withAccountsTableActions';
import { withAlertStoreConnect } from '@/containers/Alert/withAlertStoreConnect';
import { withAlertActions } from '@/containers/Alert/withAlertActions';
@@ -22,7 +22,7 @@ function AccountBulkInactivateAlert({
closeAlert,
}) {
const [isLoading, setLoading] = useState(false);
const selectedRowsCount = 0;
@@ -41,7 +41,7 @@ function AccountBulkInactivateAlert({
});
queryCache.invalidateQueries('accounts-table');
})
.catch((errors) => {})
.catch((errors) => { })
.finally(() => {
setLoading(false);
closeAlert(name);
@@ -68,5 +68,5 @@ function AccountBulkInactivateAlert({
export default compose(
withAlertStoreConnect(),
withAlertActions,
withAccountsActions,
// withAccountsActions,
)(AccountBulkInactivateAlert);

View File

@@ -70,16 +70,16 @@ function VendorCreditNoteForm({
() => ({
...(!isEmpty(vendorCredit)
? {
...transformToEditForm(vendorCredit),
}
...transformToEditForm(vendorCredit),
}
: {
...defaultVendorsCreditNote,
...(vendorcreditAutoIncrement && {
vendor_credit_number: vendorCreditNumber,
}),
currency_code: base_currency,
...newVendorCredit,
...defaultVendorsCreditNote,
...(vendorcreditAutoIncrement && {
vendor_credit_number: vendorCreditNumber,
}),
currency_code: base_currency,
...newVendorCredit,
}),
}),
[vendorCredit, base_currency],
);

View File

@@ -24,6 +24,7 @@ import {
VendorsSelect,
Stack,
FDateInput,
FInputGroup,
} from '@/components';
import {
vendorsFieldShouldUpdate,
@@ -74,6 +75,7 @@ function VendorCreditNoteFormHeaderFields({
}) {
const theme = useTheme();
const fieldsClassName = getFieldsStyle(theme);
const { values } = useFormikContext();
// Handle vendor credit number changing.
const handleVendorCreditNumberChange = () => {
@@ -81,10 +83,11 @@ function VendorCreditNoteFormHeaderFields({
};
// Handle vendor credit no. field blur.
const handleVendorCreditNoBlur = (form, field) => (event) => {
const handleVendorCreditNoBlur = (event) => {
const newValue = event.target.value;
const oldValue = values.vendor_credit_number;
if (field.value !== newValue && vendorcreditAutoIncrement) {
if (oldValue !== newValue && vendorcreditAutoIncrement) {
openDialog('vendor-credit-form', {
initialFormValues: {
manualTransactionNo: newValue,
@@ -109,7 +112,6 @@ function VendorCreditNoteFormHeaderFields({
name={'exchange_rate'}
formGroupProps={{ label: ' ', inline: true }}
/>
{/* ------- Vendor Credit date ------- */}
<FFormGroup
name={'vendor_credit_date'}
@@ -130,7 +132,6 @@ function VendorCreditNoteFormHeaderFields({
</FFormGroup>
{/* ----------- Vendor Credit No # ----------- */}
<FFormGroup
name={'vendor_credit_number'}
label={<T id={'credit_note.label_credit_note'} />}
@@ -163,7 +164,7 @@ function VendorCreditNoteFormHeaderFields({
</FFormGroup>
{/* ----------- Reference ----------- */}
<FFormGroup label={<T id={'reference_no'} />} inline={true} fastField>
<FFormGroup name={'reference_no'} label={<T id={'reference_no'} />} inline={true} fastField>
<FInputGroup name={'reference_no'} minimal={true} fastField />
</FFormGroup>
</Stack>