fix: Honor Shopping Cart Price List (#18885)
diff --git a/erpnext/shopping_cart/cart.py b/erpnext/shopping_cart/cart.py
index 0922f3d..db2c327 100644
--- a/erpnext/shopping_cart/cart.py
+++ b/erpnext/shopping_cart/cart.py
@@ -336,19 +336,20 @@
def _set_price_list(quotation, cart_settings):
"""Set price list based on customer or shopping cart default"""
- if quotation.selling_price_list:
- return
+ from erpnext.accounts.party import get_default_price_list
# check if customer price list exists
selling_price_list = None
if quotation.party_name:
- from erpnext.accounts.party import get_default_price_list
- selling_price_list = get_default_price_list(frappe.get_doc("Customer", quotation.party_name))
+ selling_price_list = frappe.db.get_value('Customer', quotation.party_name, 'default_price_list')
# else check for territory based price list
if not selling_price_list:
selling_price_list = cart_settings.price_list
+ if not selling_price_list and quotation.party_name:
+ selling_price_list = get_default_price_list(frappe.get_doc("Customer", quotation.party_name))
+
quotation.selling_price_list = selling_price_list
def set_taxes(quotation, cart_settings):