Frappe New DocType Command
Create a new DocType with proper configuration:
- Verify environment: Ensure we're in a Frappe bench directory
- Get DocType details:
- App name where DocType should be created
- DocType name (will be in Title Case)
- Module name (must exist in the app)
- Is it a single DocType? (Single/submittable/standard)
- Is it submittable?
- Is naming automatic or based on a field?
- DocType configuration:
- Ask about common fields to add:
- Naming series
- Status field
- Common fields (customer, company, etc.)
- Ask about permissions (which roles should have access)
- Track changes option
- Quick entry option
- Create the DocType: Use one of these approaches:
- Via desk: Guide user to create via UI (recommended for complex DocTypes)
- Via JSON: Create the JSON file directly in the app
- Via bench console: Use Python script to create programmatically
- Add common fields: If user wants, add standard fields:
- Naming Series
- Status (Draft, Submitted, Cancelled)
- Amended From (for submittable docs)
- Company (for multi-company setups)
- Set up permissions: Create basic permission rules
- Post-creation steps:
- Run
bench --site <site-name> migrate to sync DocType
- Suggest creating related DocTypes (child tables, etc.)
- Provide guidance on adding controller methods
- Mention form scripts and customizations
Development tips: Explain DocType naming conventions, field types, and best practices for controller development.