fix(patch): Fix edge cases for Batch

This commit is contained in:
Rohan Bansal 2019-04-11 15:57:13 +05:30 committed by Nabin Hait
parent 56827a372c
commit 40611080da

View File

@ -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)