Version 16: User Permission "Apply to All" blocks Script Report filters (PermissionError)

Hi everyone,

I’m facing a permission issue in Version 16 with a custom Script Report.

The Setup:

  1. I have a user restricted to a specific Warehouse using User Permissions.

  2. “Apply To All Document Types” is checked.

  3. The Script Report has a Company Link filter.

The Problem: When the user tries to run the report, they get a 417 (EXPECTATION FAILED) error: frappe.exceptions.ValidationError: You do not have permission to access Company: [Company Name].

The traceback shows that frappe.desk.query_report.run calls validate_filters_permissions, which blocks the report because the user’s Warehouse restriction doesn’t “match” the Company record.

What I’ve tried:

  • Setting frappe.flags.ignore_permissions = True in the .py file, but the error happens at the “gate” before the script even executes.

  • If I uncheck “Apply To All Document Types” and set “Applicable For” to only Item, the report works, but then the user isn’t restricted in Sales Orders or Material Requests.

Question: In Version 16, how can I keep a strict Warehouse restriction for transactions (Sales Order, etc.) without it blocking the Company/Customer filters in Script Reports? Is there a way to exclude specific reports from this global filter validation?

Thanks in advance!

The same issue in version v15 is hidden in user > role and permission, the allow roles, and the allow module. And their customer service replies with just disabling the client. The heck, we’re paying 50 bucks just for this.

Hi, not sure if this helps. I was facing similar issue with a client script(It shows a popup warning if customer has unpaid bills in sales order DOCTYPE) but sales users don’t have access to what that script checks. Did solve it by server script with api, and the client script now calls server script to check and it is working.