brotherton-erpnext/erpnext/patches/v13_0/update_job_card_status.py
2021-11-09 18:04:50 +05:30

19 lines
435 B
Python

# Copyright (c) 2021, Frappe and Contributors
# License: GNU General Public License v3. See license.txt
import frappe
def execute():
job_card = frappe.qb.DocType("Job Card")
(frappe.qb
.update(job_card)
.set(job_card.status, "Completed")
.where(
(job_card.docstatus == 1)
& (job_card.for_quantity <= job_card.total_completed_qty)
& (job_card.status.isin(["Work In Progress", "Material Transferred"]))
)
).run()