Merge pull request #40250 from GursheenK/company-filter-in-cost-center-allocation
fix(minor): company filter in cost center allocation
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 ab0baab..0da9016 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
+ }
};
});
}