Merge pull request #2696 from nabinhait/fix1

net_total and grand_total mismatch issue
diff --git a/erpnext/__version__.py b/erpnext/__version__.py
index a6040f0..823132d 100644
--- a/erpnext/__version__.py
+++ b/erpnext/__version__.py
@@ -1 +1 @@
-__version__ = '4.21.0'
+__version__ = '4.21.1'
diff --git a/erpnext/hooks.py b/erpnext/hooks.py
index 99aaff0..8013529 100644
--- a/erpnext/hooks.py
+++ b/erpnext/hooks.py
@@ -4,7 +4,7 @@
 app_description = "Open Source Enterprise Resource Planning for Small and Midsized Organizations"
 app_icon = "icon-th"
 app_color = "#e74c3c"
-app_version = "4.21.0"
+app_version = "4.21.1"
 
 error_report_email = "support@erpnext.com"
 
diff --git a/erpnext/public/js/transaction.js b/erpnext/public/js/transaction.js
index 6d38b46..e1e78a3 100644
--- a/erpnext/public/js/transaction.js
+++ b/erpnext/public/js/transaction.js
@@ -404,23 +404,27 @@
 	_set_values_for_item_list: function(children) {
 		var me = this;
 		var price_list_rate_changed = false;
-		$.each(children, function(i, d) {
+		for(var i=0, l=children.length; i<l; i++) {
+			var d = children[i];
 			var existing_pricing_rule = frappe.model.get_value(d.doctype, d.name, "pricing_rule");
-			$.each(d, function(k, v) {
+
+			for(var k in d) {
+				var v = d[k];
 				if (["doctype", "name"].indexOf(k)===-1) {
 					if(k=="price_list_rate") {
 						if(flt(v) != flt(d.price_list_rate)) price_list_rate_changed = true;
 					}
 					frappe.model.set_value(d.doctype, d.name, k, v);
 				}
-			});
+			}
+
 			// if pricing rule set as blank from an existing value, apply price_list
 			if(!me.frm.doc.ignore_pricing_rule && existing_pricing_rule && !d.pricing_rule) {
 				me.apply_price_list(frappe.get_doc(d.doctype, d.name));
 			}
+		}
 
-			if(!price_list_rate_changed) me.calculate_taxes_and_totals();
-		});
+		if(!price_list_rate_changed) me.calculate_taxes_and_totals();
 	},
 
 	apply_price_list: function(item) {
diff --git a/setup.py b/setup.py
index aa408de..d87fb62 100644
--- a/setup.py
+++ b/setup.py
@@ -1,7 +1,7 @@
 from setuptools import setup, find_packages
 import os
 
-version = "4.21.0"
+version = "4.21.1"
 
 with open("requirements.txt", "r") as f:
 	install_requires = f.readlines()