patch: set payroll entry status

This commit is contained in:
Rucha Mahabal 2022-05-19 20:35:56 +05:30
parent ef8164f188
commit 7d4872aedd
2 changed files with 17 additions and 0 deletions

View File

@ -372,3 +372,4 @@ erpnext.patches.v14_0.discount_accounting_separation
erpnext.patches.v14_0.delete_employee_transfer_property_doctype erpnext.patches.v14_0.delete_employee_transfer_property_doctype
erpnext.patches.v13_0.create_accounting_dimensions_in_orders erpnext.patches.v13_0.create_accounting_dimensions_in_orders
erpnext.patches.v13_0.set_per_billed_in_return_delivery_note erpnext.patches.v13_0.set_per_billed_in_return_delivery_note
erpnext.patches.v13_0.set_payroll_entry_status

View File

@ -0,0 +1,16 @@
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()