brotherton-erpnext/erpnext/patches/v13_0/set_payroll_entry_status.py
2022-05-19 20:35:56 +05:30

17 lines
320 B
Python

import frappe
from frappe.query_builder import Case
def execute():
PayrollEntry = frappe.qb.DocType("Payroll Entry")
(
frappe.qb.update(PayrollEntry).set(
"status",
Case()
.when(PayrollEntry.docstatus == 0, "Draft")
.when(PayrollEntry.docstatus == 1, "Submitted")
.else_("Cancelled"),
)
).run()