fix: fetch correct selling price.
diff --git a/erpnext/utilities/product.py b/erpnext/utilities/product.py
index 1947c29..0a45002 100644
--- a/erpnext/utilities/product.py
+++ b/erpnext/utilities/product.py
@@ -68,6 +68,8 @@
return qty
def get_price(item_code, price_list, customer_group, company, qty=1):
+ from erpnext.e_commerce.shopping_cart.cart import get_party
+
template_item_code = frappe.db.get_value("Item", item_code, "variant_of")
if price_list:
@@ -79,7 +81,8 @@
filters={"price_list": price_list, "item_code": template_item_code})
if price:
- pricing_rule = get_pricing_rule_for_item(frappe._dict({
+ party = get_party()
+ pricing_rule_dict = frappe._dict({
"item_code": item_code,
"qty": qty,
"stock_qty": qty,
@@ -90,7 +93,12 @@
"conversion_rate": 1,
"for_shopping_cart": True,
"currency": frappe.db.get_value("Price List", price_list, "currency")
- }))
+ })
+
+ if party and party.doctype == "Customer":
+ pricing_rule_dict.update({"customer": party.name})
+
+ pricing_rule = get_pricing_rule_for_item(pricing_rule_dict)
price_obj = price[0]
if pricing_rule: