Skip to content

Commit

Permalink
fix: Remove free items
Browse files Browse the repository at this point in the history
(cherry picked from commit 0581000)
  • Loading branch information
deepeshgarg007 authored and mergify[bot] committed Dec 8, 2022
1 parent 033b2a4 commit 5e5937d
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions erpnext/public/js/controllers/transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -1360,16 +1360,21 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
var item_list = [];

$.each(this.frm.doc["items"] || [], function(i, d) {
if (d.item_code && !d.is_free_item) {
item_list.push({
"doctype": d.doctype,
"name": d.name,
"item_code": d.item_code,
"pricing_rules": d.pricing_rules,
"parenttype": d.parenttype,
"parent": d.parent,
"price_list_rate": d.price_list_rate
})
if (d.item_code) {
if (d.is_free_item) {
// Simply remove free items
me.frm.get_field("items").grid.grid_rows[i].remove();
} else {
item_list.push({
"doctype": d.doctype,
"name": d.name,
"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({
Expand Down

0 comments on commit 5e5937d

Please sign in to comment.