From 6942ab10125cfaf07c526df53a7c88bffcc5b9da Mon Sep 17 00:00:00 2001 From: s-aga-r Date: Mon, 23 Oct 2023 19:12:55 +0530 Subject: [PATCH] chore: patch to update `From Voucher` details --- erpnext/patches.txt | 1 + .../v15_0/update_sre_from_voucher_details.py | 15 +++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 erpnext/patches/v15_0/update_sre_from_voucher_details.py diff --git a/erpnext/patches.txt b/erpnext/patches.txt index d59fe0ec4c..53bddb562c 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -340,5 +340,6 @@ erpnext.patches.v14_0.update_invoicing_period_in_subscription execute:frappe.delete_doc("Page", "welcome-to-erpnext") erpnext.patches.v15_0.delete_payment_gateway_doctypes erpnext.patches.v14_0.create_accounting_dimensions_in_sales_order_item +erpnext.patches.v15_0.update_sre_from_voucher_details # below migration patch should always run last erpnext.patches.v14_0.migrate_gl_to_payment_ledger \ No newline at end of file diff --git a/erpnext/patches/v15_0/update_sre_from_voucher_details.py b/erpnext/patches/v15_0/update_sre_from_voucher_details.py new file mode 100644 index 0000000000..a9653ccbf4 --- /dev/null +++ b/erpnext/patches/v15_0/update_sre_from_voucher_details.py @@ -0,0 +1,15 @@ +import frappe +from frappe.query_builder.functions import IfNull + + +def execute(): + sre = frappe.qb.DocType("Stock Reservation Entry") + ( + frappe.qb.update(sre) + .set(sre.from_voucher_type, "Pick List") + .set(sre.from_voucher_no, sre.against_pick_list) + .set(sre.from_voucher_detail_no, sre.against_pick_list_item) + .where( + (IfNull(sre.against_pick_list, "") != "") & (IfNull(sre.against_pick_list_item, "") != "") + ) + ).run()