From 0ede99b3cb508ec88c4773b82b0a5710c2e15a52 Mon Sep 17 00:00:00 2001 From: Gursheen Anand Date: Sun, 3 Mar 2024 18:08:23 +0530 Subject: [PATCH] feat: add company filter to child table field (cherry picked from commit 51909077bd90fe86ab3e1c916412a18e183ab823) --- .../cost_center_allocation.js | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/erpnext/accounts/doctype/cost_center_allocation/cost_center_allocation.js b/erpnext/accounts/doctype/cost_center_allocation/cost_center_allocation.js index ab0baab24a0f..0da90161f518 100644 --- a/erpnext/accounts/doctype/cost_center_allocation/cost_center_allocation.js +++ b/erpnext/accounts/doctype/cost_center_allocation/cost_center_allocation.js @@ -3,16 +3,21 @@ frappe.ui.form.on('Cost Center Allocation', { setup: function(frm) { - let filters = {"is_group": 0}; - if (frm.doc.company) { - $.extend(filters, { - "company": frm.doc.company - }); - } - frm.set_query('main_cost_center', function() { return { - filters: filters + filters: { + company: frm.doc.company, + is_group: 0 + } + }; + }); + + frm.set_query('cost_center', 'allocation_percentages', function() { + return { + filters: { + company: frm.doc.company, + is_group: 0 + } }; }); }