How to hide a checkbox based on the option in the listbox

I’ve added a new checkbox filter on profit and loss statement report by modifying the financial_statements.js file.
“filters”: [
{
“fieldname”:“company”,
“label”: __(“Company”),
“fieldtype”: “Link”,
“options”: “Company”,
“default”: frappe.defaults.get_user_default(“company”),
“reqd”: 1
},
{
“fieldname”:“fiscal_year”,
“label”: __(“Fiscal Year”),
“fieldtype”: “Link”,
“options”: “Fiscal Year”,
“default”: frappe.defaults.get_user_default(“fiscal_year”),
“reqd”: 1
},
{
“fieldname”: “periodicity”,
“label”: __(“Periodicity”),
“fieldtype”: “Select”,
“options”: “Yearly\nHalf-yearly\nQuarterly\nMonthly”,
“default”: “Yearly”,
“reqd”: 1
},
{
“fieldname”: “accumulated_value”,
“label”: __(“Accumulated Value”),
“fieldtype”: “Check”
}
]
Now I’d like to know how to hide this “Accumulated Value” checkbox when I choose “Yearly” in the listbox.
Thank you.

],

in the depends on of checkbox write

eval:doc.checkbox_name = value

Hi, @neilLasrado, thank you for replying. But I think I should change code in financial_statements.js file because this is a report. There is no DocType I can configure. I tried to add a “On change” event in “periodicity” listbox, but I don’t know how to hide Check box in this event.

{
“fieldname”: “accumulated_value”,
“label”: __(“Accumulated Value”),
“fieldtype”: “Check”,
“depends_on”: eval:doc.periodicity = ‘Yearly’
}

According to me this must work. Not sure though. just try it out and let me know.

Hi, @neilLasrado, sorry about replying late. I just tried this code you gave me. Unfortunately, it’s not working, when I add the last line – “depends_on”: eval:doc.periodicity = ‘Yearly’, the report doesn’t show, so seems something is wrong.

@neilLasrado, When I write
“depends_on”: “eval:doc.periodicity=="Yearly"”
The report is showing, but check box is still not hiding.

@Jasmine Its not possible right now, maybe you can add a feature request on github.

@neilLasrado, Thank you very much.

use onchange like this :

		fieldname: "periodicity",
		label: __("Periodicity"),
		fieldtype: "Select",
		options:  "Yearly\nHalf-yearly\nQuarterly\nMonthly" ,
		default: "Yearly",
		on_change: () => {
			var periodicity_filter = frappe.query_report.get_filter_value('periodicity');
			var accumulated_value_filter = frappe.query_report.get_filter('accumulated_value');
			if (accumulated_value_filter =="Yearly") {
				accumulated_value_filter .toggle(false);
			} else {
				accumulated_value_filter .toggle(true);  
			}
			accumulated_value_filter .refresh();
		}