diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index 01f72adf349..1f86718990e 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -1483,48 +1483,46 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe } _set_values_for_item_list(children) { - var me = this; - var items_rule_dict = {}; + const items_rule_dict = {}; - for(var i=0, l=children.length; i 0) { - me.apply_product_discount(d); + if (child.free_item_data.length > 0) { + this.apply_product_discount(child); } - if (d.apply_rule_on_other_items) { - items_rule_dict[d.name] = d; + if (child.apply_rule_on_other_items) { + items_rule_dict[child.name] = child; } } - me.frm.refresh_field('items'); - me.apply_rule_on_other_items(items_rule_dict); - - me.calculate_taxes_and_totals(); + this.apply_rule_on_other_items(items_rule_dict); + this.calculate_taxes_and_totals(); } apply_rule_on_other_items(args) {