Make filter in child table field


What I want to do is filter in a “tax_type” field of a child table when I select the company to indicate only the fields related to the company

Something of this sort ? Maybe you can give a more detail explanation of what you want to achieve ?

frm.set_query("field_name", "childtable_name", function(doc, cdt, cdn) {
		return {
			filters: {

Hi, thanks for answering

My doctype is “Item” the child table is called “taxes” and the field in which I want to put the filter is called “tax_type”.
I want you to filter the data of “tax_type” according to the company

Assuming when you want to filter it by company, you actually mean the default company thats being set. This could be achieved by just adding the company’s filter here item.js

frm.fields_dict['taxes'].grid.get_field("tax_type").get_query = function(doc, cdt, cdn) {
	return {
		filters: [
			['Account', 'account_type', 'in',
				'Tax, Chargeable, Income Account, Expense Account'],
			['Account', 'docstatus', '!=', 2],
			['Account', 'company', '=', frappe.defaults.get_default('company')]
1 Like