Changing a filter in Odoo javascript - challenge overcome

In a project I am working on, I had a challenge. Apparently something simple I said: this should be solved in a couple of hours. This couple of hours turned into days. Yes, put Javascript and an older version of Odoo (13) together, with which I had pratically zero experience, and this can happen.
The standard approach I was used to include a javascript file in the code base wasn’t working. I tried differently and still not working.
I tried it for around 2 to three days and then other priorities came along.
And now, maybe a month later, it was finally time to retry.

The challenge was to restrict a filter in a popup window in Odoo. Namely, in a Purchase Order, when clicking on “Search More…” in vendors, effectively only see Vendors (which show up in the Purchase Module as a menu as well)

After all these hours trying to understand why my new javascript code wasn’t loading, a tip from a colleague did the trick: check if something similar is already being done in the current codebase. So apprently simple and so time-lengthy to achieve: ask for help and check if anything similar has been done in this project.

And so, while thinking “How come I haven’t thought of this before…I usually do it…”, I found a way, with some tips from chatgpt and copilot.

the code for this is available at inheritance - How to add a filter to a popup window generated by javascript in Odoo 13 - Stack Overflow

Hope you had a nice time reading this.