mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-01 03:09:09 +00:00
Co-authored-by: Mihir Kandoi <kandoimihir@gmail.com> fix: item price with party condition (#55100)
This commit is contained in:
@@ -543,6 +543,7 @@ class TestBatch(ERPNextTestSuite):
|
|||||||
"plc_conversion_rate": 1,
|
"plc_conversion_rate": 1,
|
||||||
"customer": "_Test Customer",
|
"customer": "_Test Customer",
|
||||||
"name": None,
|
"name": None,
|
||||||
|
"qty": 1,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -161,6 +161,7 @@ class TestItem(ERPNextTestSuite):
|
|||||||
"conversion_factor": 1,
|
"conversion_factor": 1,
|
||||||
"price_list_uom_dependant": 1,
|
"price_list_uom_dependant": 1,
|
||||||
"ignore_pricing_rule": 1,
|
"ignore_pricing_rule": 1,
|
||||||
|
"qty": 1,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1198,9 +1198,15 @@ def get_item_price(
|
|||||||
|
|
||||||
if not ignore_party:
|
if not ignore_party:
|
||||||
if pctx.customer:
|
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:
|
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:
|
else:
|
||||||
query = query.where((IfNull(ip.customer, "") == "") & (IfNull(ip.supplier, "") == ""))
|
query = query.where((IfNull(ip.customer, "") == "") & (IfNull(ip.supplier, "") == ""))
|
||||||
|
|
||||||
@@ -1258,9 +1264,6 @@ def get_price_list_rate_for(ctx: ItemDetailsCtx, item_code):
|
|||||||
if desired_qty and check_packing_list(price_list_rate[0].name, desired_qty, item_code):
|
if desired_qty and check_packing_list(price_list_rate[0].name, desired_qty, item_code):
|
||||||
item_price_data = price_list_rate
|
item_price_data = price_list_rate
|
||||||
else:
|
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"))
|
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"):
|
if not general_price_list_rate and ctx.get("uom") != ctx.get("stock_uom"):
|
||||||
|
|||||||
Reference in New Issue
Block a user