Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix TypeError by handling NoneType in set_print_format_fields #41503

Conversation

nelsonmpanju
Copy link

##Details
This pull request fixes a TypeError in the set_print_format_fields method of the Journal Entry doctype. The error occurs when attempting to add a float to a NoneType. The changes ensure that NoneType values are handled properly by using the flt function with a default value.

##Problem
When running the Payment Reconciliation process, a TypeError is thrown due to an attempt to add a NoneType to a float. This occurs when either debit_in_account_currency or credit_in_account_currency is None.

##Solution
The solution involves updating the set_print_format_fields method to use the flt function with a default value of 0.0, ensuring that NoneType values are converted to 0.0.

##Changes Made
Modified the set_print_format_fields method in journal_entry.py to handle NoneType values properly.
Updated the calculation logic to use flt(d.debit_in_account_currency, 0.0) + flt(d.credit_in_account_currency, 0.0).

@github-actions github-actions bot added the needs-tests This PR needs automated unit-tests. label May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-tests This PR needs automated unit-tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant