Hi everyone,
I’m facing a permission issue in Version 16 with a custom Script Report.
The Setup:
-
I have a user restricted to a specific Warehouse using User Permissions.
-
“Apply To All Document Types” is checked.
-
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 = Truein the.pyfile, 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!