Skip to content
Discussion options

You must be logged in to vote

Recommended Approach

When multiple Frappe apps define permission_query_conditions for the same DocType, the conditions are combined with AND, not OR.

For example, if App A and App B both define permission conditions for Sales Invoice:

# App A
def sales_invoice(user):
    return "`tabSales Invoice`.company = 'Company A'"

# App B
def sales_invoice(user):
    return "`tabSales Invoice`.owner = 'user@example.com'"

The effective condition is essentially:

WHERE
    `tabSales Invoice`.company = 'Company A'
    AND
    `tabSales Invoice`.owner = 'user@example.com'

This can unintentionally make the permission too restrictive.

If the intended business logic is OR, the conditions need to be expli…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@pacman-24
Comment options

@tanimomor
Comment options

Answer selected by pacman-24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug GitHub or a GitHub feature is not working as intended Programming Help Discussions around programming languages, open source and software development source:ui Discussions created via Community GitHub templates
2 participants