fix: Reset indices in the Packed/Bundle Items table on deleting Product Bundles

(cherry picked from commit 8370042f82)
This commit is contained in:
GangaManoj
2021-11-24 21:05:54 +05:30
committed by mergify-bot
parent e18542ef6a
commit cfb6cbbd8c

View File

@@ -106,11 +106,15 @@ def cleanup_packing_list(doc, parent_items):
if not delete_list: if not delete_list:
return doc return doc
index = 1
packed_items = doc.get("packed_items") packed_items = doc.get("packed_items")
doc.set("packed_items", []) doc.set("packed_items", [])
for d in packed_items: for d in packed_items:
if d not in delete_list: if d not in delete_list:
d.idx = index
doc.append("packed_items", d) doc.append("packed_items", d)
index += 1
def update_product_bundle_price(doc, parent_items): def update_product_bundle_price(doc, parent_items):
"""Updates the prices of Product Bundles based on the rates of the Items in the bundle.""" """Updates the prices of Product Bundles based on the rates of the Items in the bundle."""