fix: Reset indices in the Packed/Bundle Items table on deleting Product Bundles
diff --git a/erpnext/stock/doctype/packed_item/packed_item.py b/erpnext/stock/doctype/packed_item/packed_item.py
index 095457f..0ce8ee4 100644
--- a/erpnext/stock/doctype/packed_item/packed_item.py
+++ b/erpnext/stock/doctype/packed_item/packed_item.py
@@ -106,11 +106,15 @@
if not delete_list:
return doc
+ index = 1
packed_items = doc.get("packed_items")
doc.set("packed_items", [])
+
for d in packed_items:
if d not in delete_list:
+ d.idx = index
doc.append("packed_items", d)
+ index += 1
def update_product_bundle_price(doc, parent_items):
"""Updates the prices of Product Bundles based on the rates of the Items in the bundle."""