mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-26 08:24:47 +00:00
fix(patch): Reload Batch doctype before update query
This commit is contained in:
@@ -2,6 +2,8 @@ import frappe
|
|||||||
|
|
||||||
|
|
||||||
def execute():
|
def execute():
|
||||||
|
frappe.reload_doc("stock", "doctype", "batch")
|
||||||
|
|
||||||
for batch in frappe.get_all("Batch", fields=["name", "batch_id"]):
|
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)")
|
||||||
frappe.db.set_value("Batch", batch.name, "batch_qty", batch_qty, update_modified=False)
|
frappe.db.set_value("Batch", batch.name, "batch_qty", batch_qty, update_modified=False)
|
||||||
|
|||||||
Reference in New Issue
Block a user