Merge branch 'develop' into fix-py3
diff --git a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py
index 11b0a6d..a91eaa6 100644
--- a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py
+++ b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py
@@ -346,7 +346,7 @@
 	if len(pricing_rules) > 1:
 		rate_or_discount = list(set([d.rate_or_discount for d in pricing_rules]))
 		if len(rate_or_discount) == 1 and rate_or_discount[0] == "Discount Percentage":
-			pricing_rules = filter(lambda x: x.for_price_list==args.price_list, pricing_rules) \
+			pricing_rules = list(filter(lambda x: x.for_price_list==args.price_list, pricing_rules)) \
 				or pricing_rules
 
 	if len(pricing_rules) > 1 and not args.for_shopping_cart:
diff --git a/erpnext/accounts/report/sales_payment_summary/test_sales_payment_summary.py b/erpnext/accounts/report/sales_payment_summary/test_sales_payment_summary.py
index 3628c9d..a51c427 100644
--- a/erpnext/accounts/report/sales_payment_summary/test_sales_payment_summary.py
+++ b/erpnext/accounts/report/sales_payment_summary/test_sales_payment_summary.py
@@ -57,8 +57,8 @@
 			pe.cancel()
 
 		mop = get_mode_of_payments(filters)
-		self.assertTrue('Credit Card' in mop.values()[0])
-		self.assertTrue('Cash' not in mop.values()[0])
+		self.assertTrue('Credit Card' in list(mop.values())[0])
+		self.assertTrue('Cash' not in list(mop.values())[0])
 
 	def test_get_mode_of_payments_details(self):
 		filters = get_filters()
@@ -84,7 +84,7 @@
 
 		mopd = get_mode_of_payment_details(filters)
 
-		mopd_values = mopd.values()[0]
+		mopd_values = list(mopd.values())[0]
 		for mopd_value in mopd_values:
 			if mopd_value[0] == "Credit Card":
 				cc_init_amount = mopd_value[1]
@@ -96,7 +96,7 @@
 			pe.cancel()
 
 		mopd = get_mode_of_payment_details(filters)
-		mopd_values = mopd.values()[0]
+		mopd_values = list(mopd.values())[0]
 		for mopd_value in mopd_values:
 			if mopd_value[0] == "Credit Card":
 				cc_final_amount = mopd_value[1]
diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py
index 23849c2..2ce6d21 100644
--- a/erpnext/controllers/accounts_controller.py
+++ b/erpnext/controllers/accounts_controller.py
@@ -1132,7 +1132,7 @@
 
 		child_item.qty = flt(d.get("qty"))
 
-		if child_item.billed_amt > (flt(d.get("rate")) * flt(d.get("qty"))):
+		if flt(child_item.billed_amt) > (flt(d.get("rate")) * flt(d.get("qty"))):
 			frappe.throw(_("Row #{0}: Cannot set Rate if amount is greater than billed amount for Item {1}.")
 						 .format(child_item.idx, child_item.item_code))
 		else: