add-portal-pagelisted
Install: claude install-skill prilk-consulting/frappe-agent-kit
# Add a Portal Page for a DocType
End-to-end workflow. Uses the portal-list pattern (right for transaction/user-owned documents — the common case). If the content is *publishable* (blog-like, public URLs per document), stop and use the WebsiteGenerator pattern from the frappe-portal skill instead.
## Usage
Use this skill when:
- "Customers should see their orders / invoices / certificates on the portal"
- Adding a portal list + detail view with per-user access control
- Wiring a new entry into the portal sidebar menu
## Steps
### 1. Decide the access rule first
Who may see which documents? The answer becomes `has_website_permission` and the list filter. Common shapes:
| Rule | Filter |
|------|--------|
| Owner only | `{"owner": frappe.session.user}` or a `user` Link field |
| Customer's documents | via `portal_users` lookup (ERPNext pattern) |
| Role-gated, all docs | role check only — rare, double-check with the user |
### 2. Controller module — list context + permission
In the DocType's `.py` module (module level, NOT inside the class):
```python
def get_list_context(context=None):
return {
"show_sidebar": True,
"title": _("My Documents"),
"get_list": get_filtered_list,
"row_template": "templates/includes/<app>/<doctype>_row.html",
"list_template": "templates/includes/list/list.html",
}
def get_filtered_list(doctype, txt, filters, limit_start, limit_page_length=20, order_by=None):
return frappe.get_all(doctype