How Filter a field based in child table

I want to apply a filter on a field, but based on a child table in another doctype…
I have a child table “usr_perm” (User Permission Table) in doctype User where I keep the companies where that user works.

I have create a new doctype with a field “company”. It’s link type to doctype Company. I want to filter the the field company/companies to which the current user belongs. How to make that filter or any idea how to do it?

I am trying something similar to this…

cur_frm.set_query("company", function () {
	return {
		filters: [
			["User Permission Table", "owner", "=", frappe.session.user]

Any input is really appreciated. Thanks