From 6c1870be8f7ad3417b6e841df6a4135dff7d9b0b Mon Sep 17 00:00:00 2001 From: Ahmed Bouhuolia Date: Wed, 13 Nov 2024 18:15:13 +0200 Subject: [PATCH] fix: make manual entries adjust decimal credit/debit amounts --- .../webapp/src/containers/Accounting/MakeJournal/utils.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/webapp/src/containers/Accounting/MakeJournal/utils.tsx b/packages/webapp/src/containers/Accounting/MakeJournal/utils.tsx index ab7ff4c49..38fa852e5 100644 --- a/packages/webapp/src/containers/Accounting/MakeJournal/utils.tsx +++ b/packages/webapp/src/containers/Accounting/MakeJournal/utils.tsx @@ -4,7 +4,7 @@ import * as R from 'ramda'; import moment from 'moment'; import intl from 'react-intl-universal'; import { Intent } from '@blueprintjs/core'; -import { sumBy, setWith, toSafeInteger, get, first } from 'lodash'; +import { sumBy, setWith, get, first, toNumber } from 'lodash'; import { updateTableCell, repeatValue, @@ -91,8 +91,8 @@ export function transformToEditForm(manualJournal) { * Entries adjustment. */ function adjustmentEntries(entries) { - const credit = sumBy(entries, (e) => toSafeInteger(e.credit)); - const debit = sumBy(entries, (e) => toSafeInteger(e.debit)); + const credit = sumBy(entries, (e) => toNumber(e.credit)); + const debit = sumBy(entries, (e) => toNumber(e.debit)); return { debit: Math.max(credit - debit, 0),