fix: test case

This commit is contained in:
Rohit Waghchaure 2019-02-27 19:31:32 +05:30
parent cd34c70670
commit b48effebce
2 changed files with 3 additions and 3 deletions

View File

@ -11,7 +11,7 @@ from erpnext.stock.doctype.item_price.item_price import ItemPriceDuplicateItem
class TestItemPrice(unittest.TestCase): class TestItemPrice(unittest.TestCase):
def setUp(self): 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) make_test_records_for_doctype("Item Price", force=True)
def test_duplicate_item(self): def test_duplicate_item(self):

View File

@ -490,7 +490,7 @@ def get_price_list_rate_for(args, item_code):
price_list_rate = get_item_price(item_price_args, item_code) price_list_rate = get_item_price(item_price_args, item_code)
if price_list_rate: if price_list_rate:
desired_qty = args.get("qty") 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 item_price_data = price_list_rate
else: else:
for field in ["customer", "supplier", "min_qty"]: 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 flag = True
item_price = frappe.get_doc("Item Price", price_list_rate_name) 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 packing_increment = desired_qty % item_price.packing_unit
if packing_increment != 0: if packing_increment != 0: