fix: Delete orphaned asset movement item records

This commit is contained in:
Nabin Hait
2024-02-20 12:11:12 +05:30
parent 11bddc14bb
commit 46cd929d00
2 changed files with 8 additions and 0 deletions

View File

@@ -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

View File

@@ -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`)
""")