As requested, I am posting the structure of the report here. Basically we want to set the company filter on this report to logged in user’s default company (company that is saved in logged in user’s employee record). Please help.
This code is working for all the users but not for 23 users. The reason for this is below.
In our ERPNext instance we have 7 companies.I am employed by company B
(in my employee record, the company is set as B). All my leave
applications are added against company B. I am assigned to two companies
(A and B) as part of User Permissions Manager so that I can create
purchase order for both Company A and B. Please note there are about 23
users who has this kind of configuration.
In our custom report, we have a company filter. Ideally, we want to
set company filter based on logged in user’s employee record. There is
an issue with using “frappe.defaults.get_user_default(“Company”) ||
frappe.defaults.get_global_default(“company”)”. It always return the
first record from user permissions manager for company doctype for the
logged in user. So when I logged it set the company filter as Company A (this is the first record in the permitted list of the companies).