JE Validation due to Rounding Issue

Dear Community,

I am currently developing an app for revaluation of accounts.

User will be able to select the foreign accounts to revaluate and the revaluation will be done via a JE.
Howeve, I have a problem with the validation due to rounding.

Upon revaluation submission, a multi currency JE will be created and saved after calculation is done via the app. The total credit and debit is balanced.

However, when I try to submit this JE, ERPNext will always detect that the JE is not balanced, prompting the amount. Do take note that the “Make Difference Entry” button on JE DocType does not appear as the JE is balanced.

It seems that the validation for save and submit of JE is different. Can anyone shed a light on this please?


Warmest Regards


Please share the screenshot of the Journal entry and error traceback.

Hi @nabinhait


Journal Entry - shows that it is balanced

Unable to Submit Journal Entry

Traceback (most recent call last):
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/”, line 56, in application
response = frappe.handler.handle()
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/”, line 21, in handle
data = execute_cmd(cmd)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/”, line 52, in execute_cmd
return, **frappe.form_dict)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/”, line 922, in call
return fn(*args, **newargs)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/desk/form/”, line 19, in savedocs
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/model/”, line 741, in submit
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/model/”, line 730, in _submit
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/model/”, line 230, in save
return self._save(*args, **kwargs)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/model/”, line 263, in _save
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/model/”, line 775, in run_before_save_methods
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/model/”, line 666, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/model/”, line 887, in composer
return composed(self, method, *args, **kwargs)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/model/”, line 870, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/model/”, line 660, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/ubuntu/frappe-bench/apps/erpnext/erpnext/accounts/doctype/journal_entry/”, line 31, in validate
File “/home/ubuntu/frappe-bench/apps/erpnext/erpnext/accounts/doctype/journal_entry/”, line 293, in validate_total_debit_and_credit
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/”, line 319, in throw
msgprint(msg, raise_exception=exc, title=title, indicator=‘red’)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/”, line 309, in msgprint
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/”, line 282, in _raise_exception
raise raise_exception(encode(msg))
ValidationError: Total Debit must be equal to Total Credit. The difference is -0.0300000000279

While creating Journal Entry, first round off the amount upto 2 decimals and then set those values to JE. Either debit or credit value has more than 2 decimal, thats is why it is giving error. While showing the value the system rounds off as per precision of the field, but in the backend it contains the original value.

That is what we thought so …

But it we were to put the round off value instead of the original value, how will it affect the JE system as a whole? Any implication?

Why your original value is greater than 2 decimals? From which document you are picking the value? Should not it be set in the document after rounding to 2 decimals?

It involves exchange rate which is usually more than 2 decimal places, required by companies. The exchange rate is taken from Currency Exchange DocType.

The rounding of the value is done after calculation, per line item.

Am just wondering, for submission, what is the validation criteria? And why save and submission have different validation criteria it seems. Granted, it is great that the document is able to be saved as draft but am having trouble to submit the JE due to the difference.

For submission, I think it should be enough if Total Debit = Total Credit amount?

1 Like