From f0137058ac99278bc17277c48e49235a6230bdd2 Mon Sep 17 00:00:00 2001 From: Corentin Forler Date: Thu, 17 Jul 2025 14:15:22 +0200 Subject: [PATCH] fix: Ensure get_price returns customer-specific price first --- erpnext/utilities/product.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/erpnext/utilities/product.py b/erpnext/utilities/product.py index 434ee260be..0efe1ae8aa 100644 --- a/erpnext/utilities/product.py +++ b/erpnext/utilities/product.py @@ -27,6 +27,12 @@ def get_price(item_code, price_list, customer_group, company, qty=1, uom=None, p filters["ifnull(company, '')"] = ("in", ["", company]) order_by = f"ifnull(company, '') desc, {order_by}" + if party and party.doctype == "Customer": # @dokos + filters["ifnull(customer, '')"] = ("in", ["", party.name]) + order_by = f"ifnull(customer, '') desc, {order_by}" + else: + filters["customer"] = ("is", "not set") + price = frappe.get_all( "Item Price", fields=["price_list_rate", "currency", "uom"], filters=filters, order_by=order_by ) # @dokos -- GitLab