Frappe Python
Frappe hooks
DocType
frappe type annotations
Frappe hooks.py
Frappe DocType
frappe Developer
Type-checking in Frappe
When creating a new DocType
in Frappe
, you might notice that the Custom
checkbox is non-interactable (read-only).
This happens if developer_mode
is not active and the developer_mode
parameter is set to 1
in the site_config.json
file.
If the Custom setting is unchecked, the DocType
will store document
data
in the codebase
of the specified app.
Custom DocType with Type-Checking
When creating a non-custom DocType, you’ll notice a simple .py file for form manipulation. However, type-checking is not enabled by default.
To enable type-checking by default, you need to modify the hooks.py
file within your app, located at:
[yourFrappeBenchFolder]/apps/[yourAppName]/[yourAppName]/hooks.py
Add the following configuration:
# For type-checking
export_python_type_annotations = True
Finally, navigate to your DocType, update any field
names
, and save
the DocType
.