fix: Remove free items

This commit is contained in:
Deepesh Garg 2022-12-05 17:59:02 +05:30
parent 55c0770280
commit 0581000990

View File

@ -1360,16 +1360,21 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
var item_list = []; var item_list = [];
$.each(this.frm.doc["items"] || [], function(i, d) { $.each(this.frm.doc["items"] || [], function(i, d) {
if (d.item_code && !d.is_free_item) { if (d.item_code) {
item_list.push({ if (d.is_free_item) {
"doctype": d.doctype, // Simply remove free items
"name": d.name, me.frm.get_field("items").grid.grid_rows[i].remove();
"item_code": d.item_code, } else {
"pricing_rules": d.pricing_rules, item_list.push({
"parenttype": d.parenttype, "doctype": d.doctype,
"parent": d.parent, "name": d.name,
"price_list_rate": d.price_list_rate "item_code": d.item_code,
}) "pricing_rules": d.pricing_rules,
"parenttype": d.parenttype,
"parent": d.parent,
"price_list_rate": d.price_list_rate
})
}
} }
}); });
return this.frm.call({ return this.frm.call({