Understanding DocType Features in Frappe Framework (Version 15)
Introduction — What Are DocType Features?
In the Frappe Framework, a DocType is the backbone of data modeling every record in Frappe, from a Customer to a Task, exists as a DocType.
But beyond storing data, DocTypes come with powerful features that define their behavior, relationships, workflows, and interactions within the system.
Frappe v15 enhances these features to make development faster, more modular, and flexible. Understanding these built-in features helps developers create dynamic, production-grade business applications efficiently.
Key Features of a DocType in Frappe v15
Each DocType has built-in attributes that determine how it behaves in the system. Below are the major DocType features available in Frappe Framework Version 15.
1. Is Submittable
When enabled, a DocType supports the Submit / Cancel workflow (similar to how Invoices or Leave Applications work).
- Purpose: Prevent modification after submission.
- Default Field: docstatus (0 = Draft, 1 = Submitted, 2 = Cancelled)
Example: Sales Invoice, Journal Entry
{
"is_submittable": 1
}
After submission, you cannot edit records directly unless you Amend them.
2. Is Child Table
This feature defines a DocType as a child table, which exists within another parent DocType.
- Use Case: Line items in Sales Invoice, or multiple Contact Numbers in a Customer record.
- Field Name in Parent DocType: Table MultiSelect
- Configuration: Set “Is Child Table” to 1 in the DocType settings.
Example directory structure:
customer/
├── customer.json
├── contact_details/
│ ├── contact_details.json
│ └── contact_details.py
3. Is Single
If checked, the DocType stores only one record in the database.
Used for global configuration or system-wide settings.
- Examples: “System Settings”, “Email Account”
- Storage: Stored in tabSingles instead of a dedicated table.
- Access: Via frappe.db.get_single_value(“DocType”, “fieldname”)
frappe.db.set_value("System Settings", None, "enable_telemetry", 0)
4. Track Changes
When enabled, Frappe automatically logs any field-level changes to the document.
- Changes are stored in the Version DocType.
- Useful for audit trails, compliance, and debugging.
Configuration:
{
"track_changes": 1
}
- You can view change logs in the Timeline or via:
frappe.get_all("Version", filters={"ref_doctype": "Task"})
5. Track Seen
Tracks which users have viewed a document.
This helps in monitoring internal communication and workflow transparency.
- System records the user who opened the form.
- Appears in the “Seen By” section in the document view.
6. Track Document Status
Enables tracking document lifecycle events such as Created, Modified, Submitted, and Cancelled.
- Used internally by modules like Workflow and Activity Log.
- Improves audit visibility.
7. Has Web View
This feature allows a DocType to be published on the website.
You can make records visible through /doctype_name/document_name routes.
- Enabling:
Check “Has Web View” in DocType configuration. - Use Case: Blog Post, Product, Event
Example path:
/blog/my-first-post
To customize the page:
/www/blog.html
8. Allow Import and Export
This feature allows data migration directly via the Data Import Tool.
- Allow Import: Enables importing records via CSV or Excel.
- Allow Export: Allows exporting data for reporting or migration.
Useful for bulk record creation or integration with legacy systems.
9. Allow Rename
This setting determines if the document’s name (primary key) can be changed.
- Use Case: Renaming a Customer Code or Item Name.
CLI Usage:
bench rename-doc Customer "Old Name" "New Name"
10. Quick Entry
Enables a simplified Quick Entry Dialog for faster data entry through a modal popup.
- Appears when adding records from links or dropdowns.
- Useful for high-frequency data like Contacts or Addresses.
11. Editable Grid
Applicable for Child Table DocTypes.
If enabled, records can be edited inline within the parent document grid.
{
"editable_grid": 1
}
12. Indexes and Search Fields
Defines which fields are searchable or indexed for better query performance.
In the DocType JSON:
{
"search_fields": "customer_name, customer_group"
}
- Indexing at DB Level: Frappe automatically indexes key columns like name, owner, and modified.
13. Permissions and Role-Based Access
DocTypes allow granular permission control.
- Levels: Read, Write, Create, Delete, Submit, Cancel, Amend
- Assigned in Permissions Table of the DocType form.
- Can be extended via Role Permissions Manager or custom scripts.
Example:
{
"permissions": [
{
"role": "System Manager",
"read": 1,
"write": 1,
"create": 1
}
]
}
Advanced Features in Frappe v15 DocTypes
Frappe 15 introduced several enhancements for developer flexibility and system performance.
Auto Name Configuration
Custom naming patterns using Naming Series or dynamic functions.
{
"autoname": "format:TASK-.#####"
}
Customizable List View and Kanban
- Configure List View columns via DocType settings.
- Create Kanban boards linked to status fields.
Workflow Integration
Attach Workflow actions directly to DocTypes for controlled document approvals.
Linked DocTypes
Easily establish relationships using Link and Dynamic Link field types.
Example:
{
"fieldtype": "Link",
"options": "Customer"
}
Best Practices
- Use “Is Single” only for settings and configurations.
- Avoid frequent structural edits to standard DocTypes; use Custom Fields instead.
- Keep permissions minimal for security.
- Enable Track Changes and Track Document Status for critical business records.
- Always test DocType updates on a staging environment before migrating to production.
Troubleshooting
|
Issue |
Cause |
Solution |
| Duplicate entry ‘DocTypeName’ | Attempted to create a DocType that already exists | Delete old record or rename the new one |
| PermissionError: Not allowed to create DocType | Developer Mode disabled | Run bench set-config developer_mode 1 and restart |
| Data not saving | Fieldname conflict or invalid datatype | Verify fieldtype in JSON schema |
Cross-References and Further Reading
- Create a DocType in Frappe Framework (v15)
- Frappe Model and Database Layer (GitHub v15)
- Understanding Field Types in Frappe
- ERPNext Developer Documentation