fix: Add item to packing list
diff --git a/erpnext/stock/doctype/packed_item/packed_item.py b/erpnext/stock/doctype/packed_item/packed_item.py
index 0ce8ee4..e4091c4 100644
--- a/erpnext/stock/doctype/packed_item/packed_item.py
+++ b/erpnext/stock/doctype/packed_item/packed_item.py
@@ -106,15 +106,34 @@
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
+ add_item_to_packing_list(doc, d)
+
+def add_item_to_packing_list(doc, packed_item):
+ doc.append("packed_items", {
+ 'parent_item': packed_item.parent_item,
+ 'item_code': packed_item.item_code,
+ 'item_name': packed_item.item_name,
+ 'uom': packed_item.uom,
+ 'qty': packed_item.qty,
+ 'rate': packed_item.rate,
+ 'conversion_factor': packed_item.conversion_factor,
+ 'description': packed_item.description,
+ 'warehouse': packed_item.warehouse,
+ 'batch_no': packed_item.batch_no,
+ 'actual_batch_qty': packed_item.actual_batch_qty,
+ 'serial_no': packed_item.serial_no,
+ 'target_warehouse': packed_item.target_warehouse,
+ 'actual_qty': packed_item.actual_qty,
+ 'projected_qty': packed_item.projected_qty,
+ 'incoming_rate': packed_item.incoming_rate,
+ 'prevdoc_doctype': packed_item.prevdoc_doctype,
+ 'parent_detail_docname': packed_item.parent_detail_docname
+ })
def update_product_bundle_price(doc, parent_items):
"""Updates the prices of Product Bundles based on the rates of the Items in the bundle."""