From 40611080da6f6563b99a10b2d8f3daa6a8d1fae8 Mon Sep 17 00:00:00 2001 From: Rohan Bansal Date: Thu, 11 Apr 2019 15:57:13 +0530 Subject: [PATCH] fix(patch): Fix edge cases for Batch --- erpnext/patches/v12_0/set_total_batch_quantity.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/patches/v12_0/set_total_batch_quantity.py b/erpnext/patches/v12_0/set_total_batch_quantity.py index 4f649deb54..b02da305ac 100644 --- a/erpnext/patches/v12_0/set_total_batch_quantity.py +++ b/erpnext/patches/v12_0/set_total_batch_quantity.py @@ -5,5 +5,5 @@ def execute(): frappe.reload_doc("stock", "doctype", "batch") for batch in frappe.get_all("Batch", fields=["name", "batch_id"]): - batch_qty = frappe.db.get_value("Stock Ledger Entry", {"docstatus": 1, "batch_no": batch.batch_id}, "sum(actual_qty)") + batch_qty = frappe.db.get_value("Stock Ledger Entry", {"docstatus": 1, "batch_no": batch.batch_id}, "sum(actual_qty)") or 0.0 frappe.db.set_value("Batch", batch.name, "batch_qty", batch_qty, update_modified=False)