From aadca02018f7c3bc0011c4f31b72fa6a7bedf459 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Wed, 9 Mar 2022 11:27:15 +0530 Subject: [PATCH] fix: add filters in default_discount_account (#30095) (#30125) (cherry picked from commit 3d8eaa5392fcc420820ac86eb01a6cf67cec1cc7) Co-authored-by: Mohamed-D-Ouf <65343412+Mohamed-D-Ouf@users.noreply.github.com> --- erpnext/setup/doctype/item_group/item_group.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/erpnext/setup/doctype/item_group/item_group.js b/erpnext/setup/doctype/item_group/item_group.js index 885d874720d..f570c2faec6 100644 --- a/erpnext/setup/doctype/item_group/item_group.js +++ b/erpnext/setup/doctype/item_group/item_group.js @@ -14,6 +14,16 @@ frappe.ui.form.on("Item Group", { ] } } + frm.fields_dict['item_group_defaults'].grid.get_field("default_discount_account").get_query = function(doc, cdt, cdn) { + const row = locals[cdt][cdn]; + return { + filters: { + 'report_type': 'Profit and Loss', + 'company': row.company, + "is_group": 0 + } + }; + } frm.fields_dict["item_group_defaults"].grid.get_field("expense_account").get_query = function(doc, cdt, cdn) { const row = locals[cdt][cdn]; return {