Update product.py (#8877)

Hi!

If template_item_code is None on line 71-72 the query will return ALL "Item Price" records irrespective of item_code, potentially causing the wrong price list rate to be used.

Noticed this behavior when fetching product price for a group of items without "variant_of" data.
This commit is contained in:
Felipe Orellana 2017-05-17 09:50:01 -04:00 committed by Nabin Hait
parent 76d965f340
commit 0952df29dc

View File

@ -67,7 +67,7 @@ def get_price(item_code, template_item_code, price_list, qty=1):
price = frappe.get_all("Item Price", fields=["price_list_rate", "currency"],
filters={"price_list": price_list, "item_code": item_code})
if not price:
if template_item_code and not price:
price = frappe.get_all("Item Price", fields=["price_list_rate", "currency"],
filters={"price_list": price_list, "item_code": template_item_code})