mirror of
https://github.com/frappe/erpnext.git
synced 2026-02-18 09:05:00 +00:00
fix(product bundle): fields reset if doc is new
This commit is contained in:
@@ -121,7 +121,12 @@ def get_indexed_packed_items_table(doc):
|
||||
"""
|
||||
indexed_table = {}
|
||||
for packed_item in doc.get("packed_items"):
|
||||
key = (packed_item.parent_item, packed_item.item_code, packed_item.parent_detail_docname)
|
||||
key = (
|
||||
packed_item.parent_item,
|
||||
packed_item.item_code,
|
||||
packed_item.idx if doc.is_new() else packed_item.parent_detail_docname,
|
||||
)
|
||||
|
||||
indexed_table[key] = packed_item
|
||||
|
||||
return indexed_table
|
||||
@@ -182,7 +187,11 @@ def add_packed_item_row(doc, packing_item, main_item_row, packed_items_table, re
|
||||
exists, pi_row = False, {}
|
||||
|
||||
# check if row already exists in packed items table
|
||||
key = (main_item_row.item_code, packing_item.item_code, main_item_row.name)
|
||||
key = (
|
||||
main_item_row.item_code,
|
||||
packing_item.item_code,
|
||||
main_item_row.idx if doc.is_new() else main_item_row.name,
|
||||
)
|
||||
if packed_items_table.get(key):
|
||||
pi_row, exists = packed_items_table.get(key), True
|
||||
|
||||
|
||||
Reference in New Issue
Block a user