Erpnext Syntax Hooks

🌐Community
by openaec-foundation · vlatest · Repository

This skill automates ERPNext customizations via syntax hooks, streamlining development and reducing manual effort for tailored workflows.

Install on your platform

We auto-selected Claude Code based on this skill’s supported platforms.

1

Run in terminal (recommended)

terminal
claude mcp add erpnext-syntax-hooks npx -- -y @trustedskills/erpnext-syntax-hooks
2

Or manually add to ~/.claude/settings.json

~/.claude/settings.json
{
  "mcpServers": {
    "erpnext-syntax-hooks": {
      "command": "npx",
      "args": [
        "-y",
        "@trustedskills/erpnext-syntax-hooks"
      ]
    }
  }
}

Requires Claude Code (claude CLI). Run claude --version to verify your install.

About This Skill

What it does

This skill enables AI agents to automate customizations within ERPNext using syntax hooks (specifically, modifications to hooks.py and associated event files). It streamlines development by allowing custom applications to extend core ERPNext functionality through document lifecycle events, periodic tasks (scheduling), and client-side data injection. This reduces manual effort when tailoring workflows and implementing specific business logic within the ERPNext system.

When to use it

  • Automating validation rules for Sales Invoices (e.g., preventing negative totals).
  • Scheduling daily cleanup tasks like deleting old log entries.
  • Injecting custom data into the client-side boot information for enhanced user interfaces.
  • Implementing actions after a document is submitted or cancelled.
  • Creating periodic synchronization processes within ERPNext.

Key capabilities

  • Document Lifecycle Events (doc_events): Define actions to be performed before/after insert, validate, update, submit, cancel, and trash events for documents.
  • Scheduler Events: Schedule tasks to run daily, hourly, weekly, monthly, or using custom cron expressions.
  • Extend Bootinfo: Inject custom data into the client-side boot information.
  • Custom Task Execution: Define and execute Python functions triggered by document events or scheduled times.

Example prompts

  • "Create a syntax hook to prevent Sales Invoices with negative totals."
  • "Schedule a daily task to delete logs older than one month."
  • "Implement a syntax hook that runs after a new document is inserted and logs the event details."

Tips & gotchas

  • Migration Required: After making changes to hooks.py or scheduler events, you must run bench migrate for the changes to take effect.
  • Transaction Management: Avoid manually committing database transactions within document event handlers (on_update, etc.) as Frappe handles commits automatically.
  • Updating Document Values: To modify a document's value after an on_update hook, use frappe.db.set_value() instead of directly modifying the document object.

Tags

🛡️

TrustedSkills Verification

Unlike other registries that point to live repositories, TrustedSkills pins every skill to a verified commit hash. This protects you from malicious updates — what you install today is exactly what was reviewed and verified.

Security Audits

Gen Agent Trust HubPass
SocketPass
SnykPass

Details

Version
vlatest
License
Author
openaec-foundation
Installs
30

🌐 Community

Passed automated security scans.