From 8bdb1fc62154b60ea5949cad4788aae22e9135f8 Mon Sep 17 00:00:00 2001 From: Muhammad Ibtesam Arshad Date: Tue, 12 Nov 2024 15:20:55 +0500 Subject: [PATCH] updated workflow states in purchase order patch --- ...purchase_order_according_to_new_workflow.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/one_fm/patches/v15_0/update_purchase_order_according_to_new_workflow.py b/one_fm/patches/v15_0/update_purchase_order_according_to_new_workflow.py index 9d51adfc6..d3c12dd40 100644 --- a/one_fm/patches/v15_0/update_purchase_order_according_to_new_workflow.py +++ b/one_fm/patches/v15_0/update_purchase_order_according_to_new_workflow.py @@ -9,15 +9,17 @@ def execute(): frappe.db.sql("ALTER TABLE `tabPurchase Order` drop column {0}".format(column)) # Update all PO in 'Pending Approver' to 'Pending Purchase Manager' - frappe.db.sql(""" UPDATE `tabPurchase Order` - SET workflow_state = 'Pending Purchase Manager' - WHERE workflow_state = 'Pending Approver' - """) + frappe.db.sql(""" + UPDATE `tabPurchase Order` + SET workflow_state = 'Pending Purchase Manager' + WHERE workflow_state NOT IN ('Draft', 'Approved', 'Rejected') + """) # Update all PO in 'Rejected' to 'Hold' - frappe.db.sql(""" UPDATE `tabPurchase Order` - SET workflow_state = 'Hold', docstatus = 0 - WHERE workflow_state = 'Rejected' - """) + frappe.db.sql(""" + UPDATE `tabPurchase Order` + SET workflow_state = 'Hold', docstatus = 0 + WHERE workflow_state = 'Rejected' + """) frappe.db.commit() \ No newline at end of file