Merge pull request #34021 from ruthra-kumar/handle_rare_cases_of_null_in_outstanding_calculation

fix: rare instances of IntegrityError while cancelling journals against cr note
This commit is contained in:
ruthra kumar 2023-02-13 14:14:27 +05:30 committed by GitHub
commit 4f2553e7b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1512,9 +1512,12 @@ def update_voucher_outstanding(voucher_type, voucher_no, account, party_type, pa
ref_doc = frappe.get_doc(voucher_type, voucher_no)
# Didn't use db_set for optimisation purpose
ref_doc.outstanding_amount = outstanding["outstanding_in_account_currency"]
ref_doc.outstanding_amount = outstanding["outstanding_in_account_currency"] or 0.0
frappe.db.set_value(
voucher_type, voucher_no, "outstanding_amount", outstanding["outstanding_in_account_currency"]
voucher_type,
voucher_no,
"outstanding_amount",
outstanding["outstanding_in_account_currency"] or 0.0,
)
ref_doc.set_status(update=True)