From b9a7ff7c3df77f008afa9454e3386368767bf5cd Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Sun, 12 Feb 2023 14:06:40 +0530 Subject: [PATCH] fix: IntegrityError while cancelling journals against cr note --- erpnext/accounts/utils.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py index a03de9e194..2608c03ffe 100644 --- a/erpnext/accounts/utils.py +++ b/erpnext/accounts/utils.py @@ -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)