fix: rate not being fetched for product bundles in material request

(cherry picked from commit 45c7bac2d0)

# Conflicts:
#	erpnext/stock/doctype/packed_item/packed_item.py
This commit is contained in:
Mihir Kandoi
2025-07-03 12:30:25 +05:30
committed by Mergify
parent f25097da1d
commit cfedaf5dc1

View File

@@ -7,6 +7,7 @@
import json
import frappe
import frappe.defaults
from frappe.model.document import Document
from frappe.utils import flt
@@ -340,11 +341,24 @@ def on_doctype_update():
@frappe.whitelist()
def get_items_from_product_bundle(row):
<<<<<<< HEAD
row, items = json.loads(row), []
=======
row, items = ItemDetailsCtx(json.loads(row)), []
defaults = frappe.defaults.get_defaults()
>>>>>>> 45c7bac2d0 (fix: rate not being fetched for product bundles in material request)
bundled_items = get_product_bundle_items(row["item_code"])
for item in bundled_items:
row.update({"item_code": item.item_code, "qty": flt(row["quantity"]) * flt(item.qty)})
row.update(
{
"item_code": item.item_code,
"qty": flt(row["quantity"]) * flt(item.qty),
"conversion_rate": 1,
"price_list": defaults.buying_price_list,
"currency": defaults.currency,
}
)
items.append(get_item_details(row))
return items