fix: item price with party condition (#55100)

This commit is contained in:
Mihir Kandoi
2026-05-20 17:18:15 +05:30
committed by GitHub
parent 00057b1798
commit 3084e3654c
3 changed files with 10 additions and 5 deletions

View File

@@ -543,6 +543,7 @@ class TestBatch(ERPNextTestSuite):
"plc_conversion_rate": 1,
"customer": "_Test Customer",
"name": None,
"qty": 1,
}
)

View File

@@ -161,6 +161,7 @@ class TestItem(ERPNextTestSuite):
"conversion_factor": 1,
"price_list_uom_dependant": 1,
"ignore_pricing_rule": 1,
"qty": 1,
}
)
)

View File

@@ -1202,9 +1202,15 @@ def get_item_price(
if not ignore_party:
if pctx.customer:
query = query.where(ip.customer == pctx.customer)
query = query.where(
(ip.customer == pctx.customer)
| ((IfNull(ip.customer, "") == "") & (IfNull(ip.supplier, "") == ""))
).orderby(IfNull(ip.customer, ""), order=frappe.qb.desc)
elif pctx.supplier:
query = query.where(ip.supplier == pctx.supplier)
query = query.where(
(ip.supplier == pctx.supplier)
| ((IfNull(ip.customer, "") == "") & (IfNull(ip.supplier, "") == ""))
).orderby(IfNull(ip.supplier, ""), order=frappe.qb.desc)
else:
query = query.where((IfNull(ip.customer, "") == "") & (IfNull(ip.supplier, "") == ""))
@@ -1262,9 +1268,6 @@ def get_price_list_rate_for(ctx: ItemDetailsCtx, item_code: str):
if desired_qty and check_packing_list(price_list_rate[0].name, desired_qty, item_code):
item_price_data = price_list_rate
else:
for field in ["customer", "supplier"]:
del pctx[field]
general_price_list_rate = get_item_price(pctx, item_code, ignore_party=ctx.get("ignore_party"))
if not general_price_list_rate and ctx.get("uom") != ctx.get("stock_uom"):