diff --git a/erpnext/stock/doctype/item_price/test_item_price.py b/erpnext/stock/doctype/item_price/test_item_price.py index 455dff4e15..3782f540cf 100644 --- a/erpnext/stock/doctype/item_price/test_item_price.py +++ b/erpnext/stock/doctype/item_price/test_item_price.py @@ -11,7 +11,7 @@ from erpnext.stock.doctype.item_price.item_price import ItemPriceDuplicateItem class TestItemPrice(unittest.TestCase): def setUp(self): - frappe.db.sql("delete from `tabItem Price`") + frappe.db.sql("delete from `tabItem Price`") make_test_records_for_doctype("Item Price", force=True) def test_duplicate_item(self): diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py index 8d1d779438..7f0e670f65 100644 --- a/erpnext/stock/get_item_details.py +++ b/erpnext/stock/get_item_details.py @@ -490,7 +490,7 @@ def get_price_list_rate_for(args, item_code): price_list_rate = get_item_price(item_price_args, item_code) if price_list_rate: desired_qty = args.get("qty") - if check_packing_list(price_list_rate[0][0], desired_qty, item_code): + if desired_qty and check_packing_list(price_list_rate[0][0], desired_qty, item_code): item_price_data = price_list_rate else: for field in ["customer", "supplier", "min_qty"]: @@ -523,7 +523,7 @@ def check_packing_list(price_list_rate_name, desired_qty, item_code): flag = True item_price = frappe.get_doc("Item Price", price_list_rate_name) - if desired_qty and item_price.packing_unit: + if item_price.packing_unit: packing_increment = desired_qty % item_price.packing_unit if packing_increment != 0: