Merge pull request #2693 from anandpdoshi/anand-feb-5
Fixed call to calculate
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) {