brotherton-erpnext/erpnext/patches/v13_0/job_card_status_on_hold.py

20 lines
396 B
Python

import frappe
def execute():
job_cards = frappe.get_all(
"Job Card",
{"status": "On Hold", "docstatus": ("!=", 0)},
pluck="name",
)
for idx, job_card in enumerate(job_cards):
try:
doc = frappe.get_doc("Job Card", job_card)
doc.set_status()
doc.db_set("status", doc.status, update_modified=False)
if idx % 100 == 0:
frappe.db.commit()
except Exception:
continue