From 46cd929d00a0a71ef067ef66490d999921884110 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 20 Feb 2024 12:11:12 +0530 Subject: [PATCH] fix: Delete orphaned asset movement item records --- erpnext/patches.txt | 1 + .../v14_0/delete_orphaned_asset_movement_item_records.py | 7 +++++++ 2 files changed, 8 insertions(+) create mode 100644 erpnext/patches/v14_0/delete_orphaned_asset_movement_item_records.py diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 6b7b13ff46e..125158a5add 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -358,3 +358,4 @@ erpnext.patches.v14_0.migrate_gl_to_payment_ledger erpnext.stock.doctype.delivery_note.patches.drop_unused_return_against_index # 2023-12-20 erpnext.patches.v14_0.set_maintain_stock_for_bom_item execute:frappe.db.set_single_value('E Commerce Settings', 'show_actual_qty', 1) +erpnext.patches.v14_0.delete_orphaned_asset_movement_item_records diff --git a/erpnext/patches/v14_0/delete_orphaned_asset_movement_item_records.py b/erpnext/patches/v14_0/delete_orphaned_asset_movement_item_records.py new file mode 100644 index 00000000000..dff04c09458 --- /dev/null +++ b/erpnext/patches/v14_0/delete_orphaned_asset_movement_item_records.py @@ -0,0 +1,7 @@ +import frappe + +def execute(): + frappe.db.sql(""" + DELETE FROM `tabAsset Movement Item` + WHERE parent NOT IN (SELECT name FROM `tabAsset Movement`) + """) \ No newline at end of file