From 91fcac57852271cbafbe5e62101d495aebec0c7f Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Mon, 10 Nov 2025 15:02:10 +0530 Subject: [PATCH] fix: patch for existing data --- erpnext/patches.txt | 1 + .../v16_0/update_serial_batch_entries.py | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 erpnext/patches/v16_0/update_serial_batch_entries.py diff --git a/erpnext/patches.txt b/erpnext/patches.txt index d78481268ab..5fa0f56e8e2 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -444,3 +444,4 @@ erpnext.patches.v16_0.rename_subcontracted_quantity erpnext.patches.v16_0.add_new_stock_entry_types erpnext.patches.v15_0.set_asset_status_if_not_already_set erpnext.patches.v15_0.toggle_legacy_controller_for_period_closing +erpnext.patches.v16_0.update_serial_batch_entries diff --git a/erpnext/patches/v16_0/update_serial_batch_entries.py b/erpnext/patches/v16_0/update_serial_batch_entries.py new file mode 100644 index 00000000000..26a817dc7bf --- /dev/null +++ b/erpnext/patches/v16_0/update_serial_batch_entries.py @@ -0,0 +1,17 @@ +import frappe + + +def execute(): + if frappe.db.has_table("Serial and Batch Entry"): + frappe.db.sql( + """ + UPDATE `tabSerial and Batch Entry` SABE, `tabSerial and Batch Bundle` SABB + SET + SABE.posting_datetime = SABB.posting_datetime, + SABE.voucher_type = SABB.voucher_type, + SABE.voucher_no = SABB.voucher_no, + SABE.voucher_detail_no = SABB.voucher_detail_no, + SABE.type_of_transaction = SABB.type_of_transaction + WHERE SABE.parent = SABB.name + """ + )