ERPNext Customization
You are invoking the specialized ERPNext customizer agent for extending and customizing ERPNext.
Request
$ARGUMENTS
Agent Invocation
Use the Task tool to spawn the frappe-fullstack:erpnext-customizer agent with the following configuration:
IMPORTANT: The agent name MUST be fully qualified: frappe-fullstack:erpnext-customizer
Agent Prompt Template
You are customizing ERPNext for specific business requirements.
## Task
{user's customization description}
## Context
- This is ERPNext customization (not core modification)
- All changes should be in a custom app
- Use hooks, custom fields, and fixtures
## Your Responsibilities
1. **Analyze the Customization**
- Which ERPNext DocTypes are affected?
- What custom fields are needed?
- What hooks/events to intercept?
- What workflows to implement?
2. **Explore Existing Patterns**
- Check how ERPNext handles similar cases
- Find extension points in ERPNext code
- Identify reusable utilities
3. **Implement the Customization**
- Create custom fields via fixtures
- Add hooks in hooks.py
- Write override functions
- Set up workflows if needed
4. **Ensure Portability**
- Export as fixtures
- Document the customization
- Handle ERPNext upgrades gracefully
## Output Requirements
- Custom field definitions (fixtures)
- hooks.py configuration
- Override functions
- Workflow definitions (if applicable)
- Installation/export commandsCapabilities
The erpnext-customizer agent excels at:
Custom Fields
# In install.py
from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
custom_fields = {
"Sales Invoice": [
{
"fieldname": "custom_channel",
"label": "Sales Channel",
"fieldtype": "Link",
"options": "Sales Channel",
"insert_after": "customer"
}
]
}
create_custom_fields(custom_fields)Document Hooks
# hooks.py
doc_events = {
"Sales Invoice": {
"validate": "my_app.overrides.sales_invoice.validate",
"on_submit": "my_app.overrides.sales_invoice.on_submit"
}
}Override Class
# hooks.py
override_doctype_class = {
"Sales Invoice": "my_app.overrides.CustomSalesInvoice"
}Fixtures
# hooks.py
fixtures = [
{"dt": "Custom Field", "filters": [["module", "=", "My App"]]},
{"dt": "Property Setter", "filters": [["module", "=", "My App"]]},
{"dt": "Workflow", "filters": [["name", "=", "My Workflow"]]}
]Workflows
workflow = {
"doctype": "Workflow",
"name": "Sales Order Approval",
"document_type": "Sales Order",
"is_active": 1,
"states": [...],
"transitions": [...]
}ERPNext Modules Reference
| Module | Key DocTypes |
|---|---|
| Accounts | Sales Invoice, Purchase Invoice, Payment Entry, GL Entry |
| Stock | Stock Entry, Delivery Note, Purchase Receipt, Item |
| Selling | Quotation, Sales Order, Customer |
| Buying | Purchase Order, Supplier, RFQ |
| Manufacturing | BOM, Work Order, Job Card |
| HR | Employee, Salary Slip, Leave Application |
| CRM | Lead, Opportunity |
| Projects | Project, Task, Timesheet |
| Assets | Asset, Depreciation |
Common Customizations
"Add custom field to Sales Invoice for tracking" → Custom field definition + fixture
"Validate credit limit before Sales Order submission" → Hook on before_submit
"Auto-create Task when Opportunity is won" → Hook on on_update with status check
"Custom approval workflow for Purchase Orders" → Workflow definition + custom fields for approvers
"Add custom report for sales by channel" → Script report with custom query
"Modify print format to include custom fields" → Custom print format template
Tools Available to Agent
- Glob: Find ERPNext and custom app files
- Grep: Search ERPNext patterns
- Read: Read ERPNext source for extension points
- Write: Create override files
- Edit: Modify hooks.py, fixtures
- Bash: Export fixtures, run commands
File Locations
my_app/
├── hooks.py # Hook configuration
├── fixtures/ # Exported fixtures
│ ├── custom_field.json
│ └── property_setter.json
├── install.py # Post-install setup
└── my_module/
└── overrides/
├── sales_invoice.py # SI overrides
└── sales_order.py # SO overridesPost-Implementation
Export Fixtures
bashbench --site <site> export-fixtures --app my_appInstall/Reinstall App
bashbench --site <site> install-app my_app # or bench --site <site> migrateClear Cache
bashbench --site <site> clear-cacheTest Customization
- Verify custom fields appear
- Test hook functions
- Validate workflow transitions