From 1ba4afa986841206583afa5bcb3fe005965b3232 Mon Sep 17 00:00:00 2001 From: Ganga Manoj Date: Mon, 20 Sep 2021 21:36:07 +0530 Subject: [PATCH] fix: Set parent_detail_docname to prevent overwriting Packed/Bundle Items on saving (#27571) --- erpnext/stock/doctype/packed_item/packed_item.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/erpnext/stock/doctype/packed_item/packed_item.py b/erpnext/stock/doctype/packed_item/packed_item.py index aec094b0cd5..08a24472576 100644 --- a/erpnext/stock/doctype/packed_item/packed_item.py +++ b/erpnext/stock/doctype/packed_item/packed_item.py @@ -44,8 +44,10 @@ def update_packing_list_item(doc, packing_item_code, qty, main_item_row, descrip # check if exists exists = 0 for d in doc.get("packed_items"): - if d.parent_item == main_item_row.item_code and d.item_code == packing_item_code and\ - d.parent_detail_docname == main_item_row.name: + if d.parent_item == main_item_row.item_code and d.item_code == packing_item_code: + if d.parent_detail_docname != main_item_row.name: + d.parent_detail_docname = main_item_row.name + pi, exists = d, 1 break