fix(work_order): Use single update query

This commit is contained in:
Rohan Bansal
2019-02-18 12:29:57 +05:30
parent b4745ec668
commit 6cbd3998fb
2 changed files with 8 additions and 7 deletions

0
erpnext/patches.txt Executable file → Normal file
View File

View File

@@ -4,10 +4,11 @@ import frappe
def execute(): def execute():
frappe.reload_doc("manufacturing", "doctype", "work_order") frappe.reload_doc("manufacturing", "doctype", "work_order")
for wo in frappe.get_all("Work Order"): frappe.db.sql("""
item_code = frappe.db.get_value("Work Order", wo.name, "production_item") UPDATE
item_name = frappe.db.get_value("Item", item_code, "item_name") `tabWork Order` wo
JOIN `tabItem` item ON wo.production_item = item.item_code
frappe.db.set_value("Work Order", wo.name, "item_name", item_name, update_modified=False) SET
wo.item_name = item.item_name
""")
frappe.db.commit() frappe.db.commit()