AccountedPro - Row scopes
A door's scope decides which rows it opens. You build it visually; it is stored on the door and compiled two ways — to SQL for list queries, and evaluated in Python per-row for single-document checks. An empty scope opens every row (a group with no children means “match all”, not “match nothing”).
Groups
- AND (match ALL) / OR (match ANY) — how the group's children combine.
- NOT — negate a group or a single condition.
- note / heading — a label for your own organisation; ignored by the engine.
- Drag conditions between groups with the
⋮⋮handle.
Tokens
Usable as a value anywhere:
| Token | Resolves to |
|---|---|
@me |
the current user's id |
@today |
today's date |
@now |
the current datetime |
Set-valued tokens (expand to a list of users), for in / not in:
| Token | Meaning |
|---|---|
@reporting-subtree |
the current user + everyone reporting up to them |
@my-dept-colleagues |
users in the current user's department |
@my-sales-persons |
sales persons linked to the current user |
Chips
Field condition
Test a field on the record. Supports link hops — author a condition on a field several links away (e.g. Funding Case → program → owner_group → field = X). Operators:
| Operator | Notes |
|---|---|
equals / not equals |
|
> >= < <= |
numeric / date compare |
in / not in |
comma-separated list or a set-token; a, b, c → IN ('a','b','c') |
contains / starts with / ends with |
LIKE |
between |
two values |
is set / is not set |
not-empty / empty |
reports to me |
the field holds a user in my reporting subtree |
I have access to (linked doc) |
see has-access below |
Current user is
A who gate, resolved at build time to always-true or always-false for the session user. Lets a door apply only to a specific user or set (is / is not a user; in / not in a list). A door whose Current user is gate is false for a person is skipped — it neither grants nor restricts them.
Owner
The record's owner (or a chosen user field) equals the current user — the quick “it's mine” chip.
Reports-to hierarchy
The record's owner/user field is somewhere in the current user's reporting subtree (depth-bounded). “My team's records.”
Department
The record belongs to the current user's department (optionally extended to related departments). “My department's records.”
Age
A time-window test on a date field (default creation): older than 3 months, within last 7 days. Handy for archive doors and cutoffs.
Linked record (junction EXISTS)
The workhorse for “this record relates to something the person cares about”. Compiles to EXISTS (SELECT 1 FROM <from> WHERE <join back> AND <filters>).
- EXISTS in
<DocType>— the table to look in. - where its
<field>= this<field>— the join back to the current record. - and matching (all of): filter rows — each filter is a field / operator / value row (same operators as Field condition).
Example — “the customer has an outstanding invoice”, on Sales Invoice:
EXISTS in Sales Invoice where its customer = this customer
matching: outstanding_amount not equals 0
Child-table condition
EXISTS a row in a child table of the record matching a field test — e.g. on Sales Invoice, a taxes row where account_head = X.
I have access to (the linked doc)
The most powerful relational operator. On a link field, it keeps rows where the current user can access the linked document — using the full stack: this app's rule for the target DocType and Frappe's native User-Permission match. It honours a permission level (read / write / …) and, for a Dynamic Link, can read the target DocType from a companion *_type field:
related_document · I have access to (linked doc) · read
· on: from field related_document_type · matching name
One condition then covers every related-document type. For a fixed link, choose on: DocType instead.
Raw SQL
An escape hatch: a raw WHERE fragment. Powerful and unguarded — prefer the chips.
The live SQL preview
Tick Show compiled SQL in the builder to see exactly what each door compiles to — the fastest way to catch a wrong field name or operator before you save.
Next: Fields and child tables.