Top 35 ERPNext Interview Questions and Answers



List of 35 ERPNext Interview Questions With Example and Answers

Written by Kevin S - Oct 12, 2024

ERPNext is a powerful, open-source ERP system that helps businesses automate and manage various processes, including accounting, inventory, sales, project management, and HR. As one of the leading ERPNext development and customization providers, we offer comprehensive solutions tailored to meet the unique needs of our clients. Our expertise spans from ERPNext implementation and customization to developing new applications within the ERP ecosystem.

In this guide, we have compiled a set of ERPNext developer interview questions that will help you assess a candidate's technical knowledge and skills in ERPNext development. These questions cover a wide range of topics, including customization, data migration, REST API integration, workflow creation, and performance optimization. Whether you're looking for a junior developer or a seasoned ERPNext expert, these questions are designed to evaluate a candidate’s understanding of the platform, their ability to solve complex problems, and their experience with ERPNext’s flexible architecture.

"The best way to predict the future is to create it." — Peter Drucker

Interview Questions Lists

User Acceptance is must

1. What is ERPNext, and why is it used?

ERPNext is a highly customizable open-source ERP (Enterprise Resource Planning) platform built on the Frappe framework. It integrates various business functions such as accounting, inventory, sales, human resources, purchasing, and project management into one unified system. ERPNext is used for automating business processes, improving collaboration between departments, and increasing the overall efficiency of an organization. It provides real-time data visibility, enabling better decision-making. Being open-source, it allows companies to customize workflows, forms, and reports as per their business requirements without expensive licensing fees.

2. Explain the architecture of ERPNext.

ERPNext follows a 3-tier architecture

  • Client-side - The frontend is built using JavaScript, HTML, and CSS. It handles user interactions, rendering UI components, and sending requests to the server.
  • Server-side - The server-side logic is powered by Python and is built on the Frappe framework. It processes requests from the client, performs database operations, executes business logic, and returns responses.
  • Database - ERPNext uses MariaDB, a relational database, for storing all business data, including transactions, logs, users, and configurations. The system supports multi-tenancy, meaning multiple independent business units or organizations can run on the same instance.

3. What is Frappe, and how does it relate to ERPNext?

Frappe is a full-stack, meta-data driven web application framework written in Python. ERPNext is built on top of the Frappe framework. Frappe provides essential tools for building models (Doctypes), views, and controllers. This allows developers to easily create custom apps or modify ERPNext’s core functionalities without affecting the core architecture. Frappe follows an MVC (Model-View-Controller) pattern and is also responsible for handling RESTful API calls, managing background jobs, and database interactions. In short, Frappe provides the foundation on which ERPNext is built.

4. How do you create a custom Doctype in ERPNext?

To create a custom Doctype

  1. Navigate to the Developer module - You can access this module if you have Developer Mode enabled in your ERPNext instance.
  2. Create a new Doctype - Click on the "Doctype" option and specify the name, module (like HR, Accounts, etc.), and add the fields (text, number, date, etc.) that you want to be part of this Doctype. You can also define which roles can read, write, create, and delete records of this Doctype.
  3. Set field properties - Define validation rules, field types, and other properties such as "mandatory," "unique," and "read-only" as needed.
  4. Save and Use - Once saved, the Doctype is automatically available throughout ERPNext. It can be linked to workflows, reports, and permissions as per business requirements.
doctype = frappe.new_doc({{
    "doctype": "Custom Doctype",
    "fieldname": "custom_field",
    "label": "Custom Field",
    "fieldtype": "Data"
}})
doctype.insert()
    

5. Explain the process of overriding a method in ERPNext.

To override a method in ERPNext, you typically use the hooks.py file in your custom app. The override_whitelisted_methods dictionary in hooks.py maps existing ERPNext methods to custom methods in your app. This allows you to extend or change the behavior of existing functionalities without modifying the core code.

6. How do you manage permissions in ERPNext?

Permissions in ERPNext are managed at the Doctype level and are role-based. Permissions control who can view, create, edit, or delete records for a specific Doctype. You can set permissions by navigating to the Role Permissions Manager in ERPNext.

7. What are DocEvents in ERPNext, and how can you use them?

DocEvents in ERPNext allow developers to execute custom code at specific stages in a document's lifecycle, such as before_save, on_submit, on_cancel, or before_delete. These events are defined in the hooks.py file of a custom app.

8. How do you handle validations in ERPNext?

Validations in ERPNext are typically handled by overriding the validate() method in a server-side script. This method is called when a record is saved, allowing you to enforce custom validation rules.

def validate(self):
    if self.total < 0:
        frappe.throw("Total cannot be negative")
    

9. What is the use of the hooks.py file in ERPNext?

The hooks.py file is the central configuration file for any custom app in ERPNext. It allows developers to extend ERPNext's functionality by hooking into various events, overriding core functionalities, adding custom scheduled tasks, and more. The file contains a dictionary-like structure where different hooks are defined, including doc_events, scheduler_events, and override_whitelisted_methods.

10. How do you set up scheduled tasks in ERPNext?

Scheduled tasks in ERPNext can be defined using the scheduler_events hook in the hooks.py file. These tasks can be set to run at various intervals such as hourly, daily, weekly, or at custom times.

11. What is a Web Form in ERPNext, and how do you create one?

Web Forms in ERPNext allow users to submit data directly into the ERP system via publicly accessible forms. Both logged-in and guest users can use these forms. You can use Web Forms for lead capture, feedback collection, and job applications.

To create a Web Form in ERPNext

  1. Navigate to the Website module and click on "Web Form."
  2. Define the form title and link it to a Doctype like Lead, Customer, or Job Application.
  3. Specify the fields to capture data, permissions for access, and actions like form submission.

Example of a simple Web Form

<form method="POST" action="/api/resource/Lead">
    <input type="text" name="lead_name" placeholder="Your Name">
    <input type="email" name="email_id" placeholder="Your Email">
    <input type="submit" value="Submit">
</form>

12. How do you perform data migration in ERPNext?

Data migration in ERPNext can be done using the Data Import Tool or through custom scripts using the Frappe API.

  • Data Import Tool - Upload CSV files to import or update records for various modules (e.g., Customers, Products).
  • Custom Scripts - For more complex migrations, use the Frappe API to insert or update records programmatically.
import frappe

def custom_data_migration():
    data = [
        {"doctype": "Customer", "customer_name": "John Doe", "email": "john@example.com"},
        {"doctype": "Customer", "customer_name": "Jane Smith", "email": "jane@example.com"}
    ]

    for row in data:
        doc = frappe.get_doc(row)
        doc.insert()

custom_data_migration()

"Efficiency is doing better what is already being done." — Peter Drucker

13. How do you debug an issue in ERPNext?

Debugging in ERPNext can be done in various ways

  • Server-Side Debugging - Use Python debugger (pdb) or log messages to the console using print statements or the frappe.logger() function.
  • Client-Side Debugging - Use browser developer tools to inspect JavaScript, network requests, and the browser console for client-side issues.
  • Error Logs - Check the error logs in the logs directory of your ERPNext installation.
import pdb
pdb.set_trace()  # Debugging in Python

14. How can you optimize performance in ERPNext?

Performance optimization in ERPNext can be achieved through

  • Database Indexing - Add indexes to frequently queried fields.
  • Query Optimization - Ensure SQL queries are optimized to minimize redundant data fetching.
  • Caching with Redis - Use Redis for session and caching data to reduce database load.
  • Batch Processing - Use batch inserts for bulk data updates to reduce the number of SQL queries.
ALTER TABLE tabCustomer ADD INDEX (customer_name);  # Add indexing in MariaDB

15. How do you manage multitenancy in ERPNext?

ERPNext supports multitenancy, allowing multiple sites (tenants) to run on a single ERPNext instance. Each site has its own database, ensuring data isolation between tenants.

To manage multitenancy

  1. Create a new site using the bench new-site command.
  2. Enable DNS-based multitenancy by setting dns_multitenant: true in common_site_config.json.
  3. Set up Nginx and configure it to serve multiple sites.
bench new-site site2.local  # Create a new site
bench setup nginx           # Configure Nginx for multitenancy

16. What are custom scripts in ERPNext, and how do they work?

Custom scripts in ERPNext allow you to write client-side JavaScript for forms without modifying the core codebase. They are useful for triggering events based on user input, validating fields, and performing dynamic calculations on the form. For example, you might use a custom script to calculate discounts, validate a specific input, or show/hide fields based on certain conditions.

To add a custom script

  1. Go to the Customize Form tool in the module settings.
  2. Select the DocType you want to customize and click "Custom Script."
  3. Add your JavaScript code to handle form events like field changes or button clicks.

Example Custom Script for validating a field

frappe.ui.form.on('Sales Order', {
    validate: function(frm) {
        if (frm.doc.total < 100) {
            frappe.throw("Total value cannot be less than 100.");
        }
    }
});

17. Explain how to create a custom workflow in ERPNext.

ERPNext workflows allow you to define custom approval processes for different business documents. You can create a workflow to set specific states (such as draft, submitted, approved) and assign roles to transition between these states. This helps in managing processes like order approvals, leave applications, or invoice reviews.

Steps to create a custom workflow

  1. Navigate to the Workflow module under the Settings or do a global search for "Workflow."
  2. Create a new Workflow and link it to the desired DocType (e.g., Purchase Order, Sales Invoice).
  3. Define states such as Draft, Submitted, Approved, and Rejected.
  4. Set transition rules, specifying which roles can move between states and which actions are allowed at each state.
  5. Save the workflow and apply it to your documents.

18. How do you customize print formats in ERPNext?

Customizing print formats in ERPNext allows you to modify how documents (e.g., invoices, quotations) are printed or exported as PDFs. You can use the Print Format builder for simple changes, or for more complex requirements, write custom HTML and CSS code.

To customize print formats

  1. Go to the Print Format Builder or select "New Print Format" from the DocType you want to customize (e.g., Sales Invoice).
  2. Use drag-and-drop for basic formatting or switch to HTML mode for full control.
  3. You can use Jinja templating to pull dynamic data from the DocType, like customer names, total amounts, or terms and conditions.

Example using Jinja templating

<div>
    <h2>Invoice Number: {{ doc.name }}</h2>
    <p>Customer: {{ doc.customer_name }}</p>
    <p>Total Amount: {{ doc.grand_total }}</p>
</div>

19. What is the purpose of Bench in ERPNext, and how do you use it?

Bench is a command-line utility that helps manage your ERPNext setup. It is used for a variety of operations, such as starting the ERPNext server, installing new sites, updating the system, backing up data, and managing custom apps. It is an essential tool for managing the development and production environment.

Common Bench commands

  • bench start - Start the ERPNext development server.
  • bench update - Update your ERPNext instance to the latest version.
  • bench new-site <site_name> - Create a new site (used in multitenant setups).
  • bench backup - Backup the database and files.

20. How do you handle version control for customizations in ERPNext?

Version control is essential when you customize ERPNext, especially when working in teams or deploying across environments (e.g., development, staging, production). Custom apps, modifications to the hooks.py file, and any custom scripts or doctypes should be managed in a Git repository.

Steps to handle version control

  1. Initialize a Git repository in your custom app folder
  2. git init
    git add .
    git commit -m "Initial commit of custom app"
        
  3. Push the changes to a remote repository (e.g., GitHub, GitLab)
  4. git remote add origin <repository_url>
    git push -u origin master
        
  5. Use branches to manage feature development and bug fixes.

"Change is the end result of all true learning." — Leo Buscaglia

21. What is the role of caching in ERPNext, and how is it implemented?

Caching improves the performance of ERPNext by storing frequently accessed data in memory, reducing the need to query the database for every request. Redis is used as the caching layer in ERPNext to store session data, job queues, and other cached content. It ensures faster response times and reduced load on the database.

To implement caching

  • Redis is configured by default in ERPNext, but you can fine-tune it by adjusting Redis settings in your site configuration file.
  • Use the bench setup redis command to manage Redis setup and configuration.

22. How do you implement role-based dashboards in ERPNext?

ERPNext allows for the creation of role-based dashboards, where different users see data based on their roles and permissions. These dashboards can display custom reports, charts, and KPIs (Key Performance Indicators) that are relevant to the user's role.

Steps to implement role-based dashboards

  1. Create custom reports and charts in ERPNext using the Report Builder or by writing custom SQL queries.
  2. Define different dashboards for each role (e.g., Sales, HR, Finance) by assigning relevant reports and KPIs to the dashboard.
  3. Navigate to the dashboard settings and specify which roles can access the dashboard.

23. How can you integrate third-party services with ERPNext?

ERPNext allows seamless integration with third-party services via REST APIs, webhooks, and custom apps. You can connect ERPNext with external applications, payment gateways, CRM systems, or custom-built solutions by making API calls or exposing ERPNext endpoints.

Methods for integration

  • REST API Use ERPNext’s built-in REST API to expose ERPNext functions and perform CRUD operations on various DocTypes.
  • Webhooks Use webhooks to notify third-party services when specific events happen in ERPNext, such as document submission or payment status change.
  • Custom Apps Build custom apps that integrate with external services, using Frappe client APIs for calling external services.

Example of making an API call using the Frappe client

import requests
response = requests.post('https://api.thirdparty.com/endpoint', json={"data": "value"})
print(response.json())

24. Explain the significance of naming series in ERPNext.

The naming series in ERPNext control how document IDs are generated. It ensures that documents like invoices, purchase orders, and sales orders follow a consistent pattern. Naming series can be customized based on business needs, and they provide flexibility to include dynamic elements like the year, month, or a sequential number.

For example, a Sales Order naming series could look like SAL-2024-0001, where

  • SAL is the prefix.
  • 2024 refers to the year the document was created.
  • 0001 is a sequential number.

25. How do you create and manage custom reports in ERPNext?

Custom reports in ERPNext can be built using the Report Builder for simple reports or through scripting for more complex reports. Report Builder allows you to select fields, apply filters, and group data interactively. For script-based reports, you can use Python and SQL to query the database and generate reports dynamically.

Steps to create a custom report using Report Builder

  1. Go to the "Report Builder" from the module (e.g., Sales, Stock, HR).
  2. Select the fields and filters you want to include.
  3. Save the report and share it with other users based on roles.

Example of a custom script-based report

def get_data(filters=None):
    data = frappe.db.sql("""
        SELECT item_code, item_name, stock_uom, total_qty
        FROM `tabStock Ledger Entry`
        WHERE warehouse = %s
    """, filters.warehouse, as_dict=1)
    return data

26. How do you add custom fields to an existing Doctype in ERPNext?

ERPNext allows you to easily extend existing DocTypes by adding custom fields without altering the core system. Custom fields can be text, date, number, or select fields, and are added using the "Customize Form" tool.

Steps to add a custom field

  1. Go to "Customize Form" from the module.
  2. Select the DocType you want to modify (e.g., Sales Invoice).
  3. Add the custom field, set its label, type, and properties.
  4. Save the changes, and the field will appear in the form interface.

27. What are the different ways to import data into ERPNext?

ERPNext supports multiple methods for importing data, making it flexible to integrate with various systems or migrate data from older platforms. These methods include

  • Data Import Tool Upload CSV or Excel files and map them to the desired DocType (e.g., Customers, Items).
  • Custom Scripts Write Python scripts using the Frappe API to programmatically insert or update records.
  • REST API Automate data imports by interacting with ERPNext’s REST API for creating or updating records.

Example of importing data via a script

def import_items():
    items_data = [...]  # List of items data
    for item in items_data:
        frappe.get_doc({
            "doctype": "Item",
            "item_code": item["code"],
            "item_name": item["name"],
            "item_group": item["group"],
            "stock_uom": item["uom"]
        }).insert()

28. How do you implement triggers for scheduled backups in ERPNext?

Scheduled backups in ERPNext are configured using the bench command or through site configurations. You can set up automatic backups by defining the backup frequency in the common_site_config.json file or using a cron job. Backups can be uploaded to external storage, such as cloud services, using additional custom scripts.

Steps to set up scheduled backups

  1. Edit the common_site_config.json file and set the backup_frequency parameter.
  2. Use bench setup backup to configure the backup schedule.
  3. Optionally, create a script to move backups to cloud services.

29. What are the key differences between client-side and server-side scripting in ERPNext?

Client-side and server-side scripting serve different purposes in ERPNext

  • Client-side scripting Written in JavaScript, it handles user interface interactions, field validations, and dynamic updates in real-time.
  • Server-side scripting Written in Python, it handles business logic, database queries, and ensures data integrity through methods like validate, on_submit, and before_save.

Example of client-side scripting

frappe.ui.form.on('Sales Order', {
    refresh: function(frm) {
        frm.add_custom_button('Custom Action', function() {
            frappe.msgprint('Custom button clicked!');
        });
    }
});

Example of server-side scripting

def validate(self):
    if self.total < 500:
        frappe.throw("Total amount should not be less than 500")

30. How do you optimize SQL queries in ERPNext for better performance?

Optimizing SQL queries is crucial for improving the performance of ERPNext, especially when dealing with large datasets. Here are some optimization techniques

  • Adding indexes Index frequently queried fields to speed up search operations.
  • Reduce joins Minimize the number of joins and subqueries in your SQL statements.
  • Batch processing Fetch data in batches when dealing with large volumes of records.
  • Use ORM methods Leverage Frappe’s ORM methods like frappe.db.get_value() for efficient querying.

Example of optimized SQL query

data = frappe.db.sql("""
    SELECT name, creation, customer_name 
    FROM `tabSales Order`
    WHERE customer_name = %s
    ORDER BY creation DESC
    LIMIT 50
""", (customer_name,), as_dict=1)

31. How do you implement REST API endpoints in ERPNext?

ERPNext allows you to create custom REST API endpoints by adding routes in the hooks.py file of your custom app. These routes are mapped to Python functions that handle the HTTP requests. The built-in REST API provides standard CRUD operations for core modules, but custom endpoints can be created for specific use cases.

Steps to implement a custom REST API endpoint

  1. Open the hooks.py file in your custom app.
  2. Define the API route in the override_whitelisted_methods section or create a new route under app.include_hooks.
  3. Write a Python function that processes the incoming request and returns the appropriate response.

Example of a custom API endpoint in hooks.py

override_whitelisted_methods = {
    "frappe.desk.doctype.event.event.get_events": "custom_app.api.get_custom_events"
}

In custom_app/api.py

@frappe.whitelist()
def get_custom_events(start, end):
    events = frappe.db.sql("""SELECT name, subject FROM `tabEvent` WHERE start_date >= %s AND end_date <= %s""", (start, end))
    return events

32. How do you troubleshoot slow performance in ERPNext?

To troubleshoot slow performance in ERPNext, you need to analyze different components such as database queries, server resources, and background processes. Common techniques include

  • Bench profiler Use the bench --site sitename profiler command to identify slow queries and resource-heavy processes.
  • Server logs Check logs for errors or warnings in the logs/ directory.
  • Monitor CPU/memory usage Tools like htop or top can help you monitor resource consumption on the server.
  • Optimize custom scripts Review custom scripts, as inefficient code can slow down the system.

Example of using the bench profiler

bench --site mysite.localhost profiler --sql --log-format json

33. How do you handle file uploads in ERPNext?

ERPNext supports file uploads, allowing users to attach documents, images, and other file types to various DocTypes. The uploaded files can be stored in either the file system or the database. You can access and manage these files through the File Manager in the UI or programmatically using the Frappe API.

Steps to upload a file

  1. Use the "Attach" button in any Doctype form to upload a file.
  2. Files are saved under the "File" Doctype in the system and can be accessed from there.
  3. Access files programmatically using Frappe’s API.

Example of file upload handling using Frappe API

uploaded_file = frappe.get_doc({
    "doctype": "File",
    "file_name": "mydocument.pdf",
    "file_url": "/files/mydocument.pdf"
}).insert()

34. What is the purpose of the Patch system in ERPNext?

The Patch system in ERPNext is used for applying database migrations, data corrections, and other system updates during version upgrades. Patches are Python scripts that run when ERPNext is updated, ensuring that the necessary changes are applied to the database schema or existing data.

Steps to create a patch

  1. Create a new patch file in the patches.txt file of your custom app.
  2. Write a Python function that implements the required changes (e.g., schema changes, data updates).
  3. Run bench migrate to apply the patch.

Example patch file entry

custom_app.patches.v1_0.update_custom_fields

In custom_app/patches/v1_0/update_custom_fields.py

def execute():
    if not frappe.db.exists("Custom Field", "Sales Invoice-custom_field"):
        frappe.get_doc({
            "doctype": "Custom Field",
            "fieldname": "custom_field",
            "insert_after": "posting_date",
            "label": "Custom Field",
            "fieldtype": "Data",
            "doctype": "Sales Invoice"
        }).insert()

35. How do you integrate ERPNext with external authentication systems (OAuth, LDAP, etc.)?

ERPNext supports integration with external authentication systems like OAuth2 and LDAP, allowing users to log in using third-party identity providers. This can be configured in the Authentication Settings module where you define the connection to external systems.

Steps to integrate with OAuth2

  1. Navigate to "Authentication Settings" in ERPNext.
  2. Enable OAuth2 Provider and configure the credentials (client ID, client secret, etc.).
  3. Define the scope of access and save the settings.

LDAP integration is similar, allowing you to connect ERPNext to an LDAP directory for centralized user authentication.

Conclusion

Choosing the right ERPNext development Company is crucial for ensuring the success of your ERPNext implementation or customization project. As experts in ERPNext development, we provide a full suite of services that includes custom module development, integration with third-party applications, performance tuning, and long-term support. Our experience allows us to build scalable and efficient ERP solutions tailored to your business requirements. By leveraging our knowledge, businesses can maximize the potential of ERPNext, leading to improved efficiency, better decision-making, and enhanced business growth. If you're looking for Hire ERPNext developers who can take your ERP system to the next level, get in touch with us to discuss your needs.

"The secret of change is to focus all of your energy not on fighting the old, but on building the new." — Socrates

Kevin S
Sr. Developer, Bizupsol

Helping Enterprise for Digitalization