Dynamic Form Enhancer – A Custom Frappe App

Overview


The Dynamic Form Enhancer is a powerful custom Frappe app that allows users to dynamically modify and enhance form views for any Doctype. This feature enables users to write custom HTML templates with Jinja conditions, which are then rendered in a dedicated tab inside the respective document view.


View App Demo

Key Features & Functionalities

  1. Custom HTML-Based Form Enhancements:
    • Users can write and apply custom HTML templates to any Doctype.
    • Templates are stored per Doctype and applied dynamically.
    • Supports real-time document rendering with live updates.
  2. Jinja Template-Based Data Rendering:
    • Fetch and display related document details dynamically.
    • Use Jinja conditions ({% if %}, {% for %}) to customize the view based on document data.
    • Example: Show overdue invoices in red or highlight pending stock transfers.
  3. Linked Document Tracking:
    • Automatically fetch details from related Doctypes.
    • Example: For a Sales Order, display linked invoices, pending payments, and delivery notes.
    • Users can define conditional visibility for linked data based on status.
  4. Multi-Tab & Custom Section Support:
    • The enhanced form view appears in a new tab within the document.
    • Users can switch between default and customized views effortlessly.
  5. User-Friendly HTML Editor with Preview:
    • Built-in rich-text HTML editor with live preview support.
    • Allows embedding of tables, charts, and conditional elements using Jinja.

Technical Implementation

  1. Backend Development (Python & Frappe Framework):
    • Developed a custom Doctype for storing templates per document type.
    • Implemented Jinja-based rendering engine to dynamically populate values.
    • Integrated Frappe ORM queries to fetch and display related data.
  2. Frontend Development (JavaScript & Frappe UI):
    • Created a dedicated HTML editor with syntax highlighting for Jinja.
    • Built a new tab in the form view to display enhanced templates dynamically.
    • Optimized UI for responsive layouts and clear data presentation.
  3. Dynamic Data Fetching & Jinja Implementation:
    • Allowed users to fetch linked records using Jinja templating.
    • Example Jinja snippet for displaying pending payments:
                                                          
                                                              <h3>Customer: {{ doc.customer_name }}</h3>
      {% if doc.status == "Overdue" %}
        <p style="color: red;">Payment Pending: {{ doc.pending_amount }}</p>
      {% endif %}
    • Enabled users to define custom business logic using Jinja conditions.

Use Cases & Benefits

  • For Sales & CRM Teams: View customer history, pending invoices, and follow-ups in a single tab.
  • For Accounting & Finance: Show real-time payment status and ledger balance without switching pages.
  • For Procurement & Inventory: Track supplier orders, stock levels, and pending deliveries in one view.
  • For HR & Compliance: Display employee records, payroll status, and leave balances efficiently.

My Role & Responsibilities as a Developer

As a Frappe Developer, I was responsible for:

  • Backend Development: Implemented Jinja templating engine and data fetching logic.
  • UI/UX Development: Designed a tab-based interface where additional tabs are shown or hidden based on specific conditions (e.g., payment status, order progress, or user roles). Users see only the most relevant information based on document context.
  • Database Optimization: Ensured fast retrieval of linked documents with optimized queries.
  • Security & Role Management: Restricted access based on user permissions.
  • Technologies

    Frappe, Erpnext, Python, Javascript, MySQL