|
Abhishek Kumar Oodles

Abhishek Kumar (Backend-Associate Consultant - Development)

Experience:Below 1 yr

Abhishek, a proficient backend developer, possesses a deep understanding of cutting-edge technologies, with hands-on experience in Python Django, Django Rest Framework, Odoo14, Odoo15, HTML, CSS, and various databases. His creative flair and robust analytical abilities empower him to navigate new technologies seamlessly, rendering him invaluable to any project.

Abhishek Kumar Oodles
Abhishek Kumar
(Associate Consultant - Development)

Abhishek, a proficient backend developer, possesses a deep understanding of cutting-edge technologies, with hands-on experience in Python Django, Django Rest Framework, Odoo14, Odoo15, HTML, CSS, and various databases. His creative flair and robust analytical abilities empower him to navigate new technologies seamlessly, rendering him invaluable to any project.

LanguageLanguages

DotENGLISH

Fluent

DotHindi

Fluent

Skills
Skills

DotERPNext

80%

DotPython

60%

DotDjango

60%

DotMySQL

60%

DotHTML, CSS

60%

DotjQuery

60%

DotRESTful API

60%

DotOdoo

60%

DotReact Native

60%

DotRESTful API

60%

DotJavascript

60%

DotWebhooks

60%
ExpWork Experience / Trainings / Internship

Mar 2024-Present

Assistant Consultant - Development

Gurugram


Oodles Technologies

Gurugram

Mar 2024-Present

EducationEducation

2018-2022

Dot

Galgotias University

B.Tech-Computer Science and Engineering

certificateCertifications
Dot

Python Development

PySpiders

Issued On

Jun 2023

Top Blog Posts
A Step-by-Step Guide to Building Custom Apps and Features in Frappe

Building a Custom App in Frappe: A Step-by-Step Guide

 

Frappe is a powerful framework for building web applications, most notably used as the foundation for ERPNext. This blog post will guide you through the process of creating a new app, adding a custom Doctype, defining fields, and implementing buttons to enhance functionality. Whether you're an experienced developer or just getting started, these steps will help you extend the capabilities of your Frappe applications.

 

Creating a New App in Frappe

To begin, we need to create a new app within our Frappe environment. Follow these steps:

  1. Open Your Terminal: Navigate to the Frappe Bench directory.
  2. Create a New App: Use the command:

    bench new-app your_app_name

    For example:

    bench new-app starinfinity_integration
  3. Install the App: Install it on your specific ERPNext site:

    bench --site your-site-name install-app your_app_name

    For example:

    bench --site your-site-name install-app Test
  4. Verify Installation: Log into your ERPNext instance to confirm that your new app appears in the list of installed applications.

 

Creating a New Doctype

Once your app is created, the next step is to add a custom Doctype. Here's how to do it:

  1. Log Into Your ERPNext Instance: Go to your ERPNext URL and log in with your credentials.
  2. Access the Developer Module: Navigate to the Developer module. Ensure that developer mode is enabled in your common_site_config.json file by adding:
  3. Create a New Doctype: Click on "Doctype" in the Developer module and then click "New".
  4. Fill in Doctype Details: Enter the Doctype name (e.g., Starinfinity Data), select the module, and add necessary fields.

 

Adding Fields to Your Doctype

You can define fields for your Doctype using JSON. Here's an example JSON structure for adding fields:

{
    "name": "Your DocType Name",
    "fields": [
        {
            "fieldname": "task_name",
            "label": "Task Name",
            "fieldtype": "Data",
            "mandatory": 1,
            "in_list_view": 1
        },
        {
            "fieldname": "due_date",
            "label": "Due Date",
            "fieldtype": "Date",
            "in_list_view": 1
        },
        {
            "fieldname": "assigned_to",
            "label": "Assigned To",
            "fieldtype": "Link",
            "options": "User"
        },
        {
            "fieldname": "description",
            "label": "Description",
            "fieldtype": "Text Editor"
        },
        {
            "fieldname": "status",
            "label": "Status",
            "fieldtype": "Select",
            "options": "\nOpen\nIn Progress\nClosed",
            "in_list_view": 1
        }
    ],
    "permissions": [
        {
            "role": "All",
            "read": 1,
            "write": 1,
            "create": 1,
            "delete": 1
        }
    ]

}

 

Explanation of the JSON Fields

  1. name: The name of the Doctype.
  2. fields: An array of field objects, each defining a new field.
    • fieldname: The name of the field in the database.
    • label: The label displayed in the form.
    • fieldtype: The type of field (e.g., Data, Date, Link, Text Editor, Select, etc.).
    • mandatory: Whether the field is required (1 for Yes, 0 for No).
    • reqd: This can also be used to indicate if the field is mandatory (1 for Yes, 0 for No).
    • in_list_view: Whether to display the field in the list view (1 for Yes, 0 for No).
    • options: Used for fields like Select to define the available options, separated by new lines.
  3. permissions: An array that defines permissions for different user roles. Here, it grants all permissions to the role "All".

 

Creating Buttons in Form and List Views

Adding buttons enhances user interaction with your Doctype. To create buttons in both the form and list views, follow these steps:

 

Step 1: Define the Button in the Doctype's JavaScript File

  1. Navigate to your Doctype's JavaScript file, usually located at:

    your_app_name/your_app_name/public/js/doctype_name.js
  2. Add the following code for the form view:

           frappe.ui.form.on('Your Doctype Name', {
               onload: function(frm) {
                   frm.add_custom_button(__('Your Button Label'), function() {
                       frappe.call({
                           method: 'your_app_name.your_module_name.doctype_name.your_function_name',
                           args: {
                               docname: frm.doc.name
                           },
                           callback: function(response) {
                               if (response.message) {
                                   frappe.show_alert({message: __('Success Message'), indicator: 'green'});
                               }
                           }
                       });
                   });
               }
           });

 

Step 2: Add the Button to the List View

Add the following code outside the onload function:

frappe.listview_settings['Your Doctype Name'] = {
    on_page_load: function(listview) {
        listview.page.add_inner_button(__('Your Button Label'), function() {
            var selected = listview.get_selected();
            if (selected.length > 0) {
                frappe.call({
                    method: 'your_app_name.your_module_name.doctype_name.your_function_name',
                    args: {
                        docnames: selected
                    },
                    callback: function(response) {
                        if (response.message) {
                            frappe.show_alert({message: __('Success Message'), indicator: 'green'});
                        }
                    }
                });
            } else {
                frappe.msgprint(__('Please select at least one document.'));
            }
        });
    }
};

 

Step 3: Define the Python Function

In the associated Python file for your Doctype (usually found at your_app_name/your_app_name/doctype/your_doctype_name/your_doctype_name.py), define the function:

import frappe

@frappe.whitelist()
def your_function_name(docname):
    doc = frappe.get_doc('Your Doctype Name', docname)
    doc.fieldname = 'New Value'
    doc.save()
    return "Success"


The @frappe.whitelist() decorator in Frappe allows a function to be accessed and called via client-side code (typically from JavaScript or other external sources) securely. In Frappe, functions that interact with the database or perform backend tasks are typically not accessible from the frontend unless explicitly made so, to avoid unauthorized access or security vulnerabilities.

By marking a function with @frappe.whitelist(), you are:

  1. Making the Function Publicly Accessible: It can be called from JavaScript using frappe.call or through HTTP requests (like API calls), allowing interaction between the front-end (e.g., a button click) and back-end logic.
  2. Ensuring Security: Only the functions that are decorated with @frappe.whitelist() can be accessed externally, keeping the rest of the backend methods private by default. This reduces the attack surface and ensures that only intended functions are exposed.

 

Final Thoughts

Building a custom app in Frappe empowers you to tailor your ERPNext environment to meet your unique business requirements. By understanding the fundamentals of Doctype creation, field definitions, and client-server interactions, you can create robust and efficient applications that enhance your organization's productivity and operational efficiency.

Remember, the Frappe and ERPNext communities are vibrant and supportive. Don't hesitate to seek help, share your projects, and collaborate with other developers to continuously improve your skills and applications. Regularly updating your knowledge and staying engaged with the community will ensure that your custom apps remain relevant, secure, and feature-rich.

Thank you for following this step-by-step guide. We hope it has been instrumental in your journey to building custom applications with Frappe. Should you have any questions or need further assistance, feel free to reach out through the community forums or consult the official documentation for more in-depth information.

Happy Developing!

Category: ERP Solutions
Installing Frappe 15 and ERPNext 15 on Ubuntu 22.04: A Quick Guide

How to Install Frappe 15 and ERPNext 15 on Ubuntu 22.04: A Step-by-Step Guide

 

ERPNext and Frappe are powerful open-source frameworks for business management and custom application development. Frappe 15 is the foundation for ERPNext 15, providing a robust backend to manage your business operations effectively. If you're using Ubuntu 22.04, this guide will walk you through the complete installation of Frappe 15 and ERPNext 15.

Let's examine the detailed step-by-step process for getting Frappe and ERPNext up and running on your Ubuntu server.

 

Prerequisites:

 

  • Fresh installation of Ubuntu 22.04 LTS.
  • Basic knowledge of command-line usage.
  • Root or sudo privileges.

 

Step 1: Create a Folder for the Installation

To organize the setup process, first create a dedicated folder where all your files and configurations will reside.

mkdir frappe-erpnext-setup
cd frappe-erpnext-setup

This will help keep all your files neatly organized as you install Frappe and ERPNext.

 

Step 2: Install Python Virtual Environment

The next step is to install Python and set up a virtual environment, ensuring that you have an isolated environment for the Frappe and ERPNext installation.

sudo apt install python3-dev python3-venv

This installs python3-venv to manage isolated Python environments and python3-dev to compile necessary packages.

 

Step 3: Create a Virtual Environment (optional)

Now create a virtual environment using Python:

python3 -m venv myenv

This command creates a new folder called myenv containing a fresh Python environment, separate from your system Python installation.

 

Step 4: Activate the Virtual Environment (optional)

Activate the environment by running:

source myenv/bin/activate

After activation, your terminal prompt will change to indicate that you're now inside the myenv virtual environment. Everything installed here will be contained within this environment.

 

Step 5: Update and Upgrade Packages

Before proceeding, ensure your system is up-to-date by updating and upgrading all installed packages.

sudo apt-get update -y 
sudo apt-get upgrade -y

This will make sure that all software on your machine is current, which helps avoid compatibility issues later on.

 

Step 6: Install Git

Git is required to clone repositories, including Frappe and ERPNext source code.

sudo apt-get install git

Git will allow you to clone the Frappe and ERPNext code repositories directly from GitHub.

 

Step 7: Install Python and Required Development Packages

Install additional Python and development packages needed for ERPNext.

sudo apt-get install python3-dev python3.10-dev python3-setuptools python3-pip python3-distutils

These packages ensure that Python dependencies are correctly built during the setup.

 

Step 8: Install Software Properties Common

This package helps in managing software repositories and adding PPAs (Personal Package Archives).

sudo apt-get install software-properties-common

 

Step 9: Install MariaDB

MariaDB is the database used by Frappe/ERPNext. Install it by running:

sudo apt install mariadb-server mariadb-client

MariaDB is a fork of MySQL and is used to manage all database operations in ERPNext.

 

Step 10: Install Redis Server

Redis is required for background job management in Frappe.

sudo apt-get install redis-server

Redis will handle caching and message brokering for real-time communication within Frappe.

 

Step 11: Install Other Required Packages

You will also need some additional system packages, such as wkhtmltopdf (for PDF generation) and MySQL development libraries.

sudo apt-get install xvfb libfontconfig wkhtmltopdf
sudo apt-get install libmysqlclient-dev

These packages are essential for various functionalities, including generating PDFs and connecting to MariaDB.

 

Step 12: Configure MySQL Server

Now configure the MariaDB server by securing the installation and adjusting settings.

Run the MySQL secure installation script:

sudo mysql_secure_installation

You will be prompted with several options. Follow these answers:

 

  • Enter current password for root: (Your SSH root user password)
  • Switch to unix_socket authentication [Y/n]: Y
  • Change the root password? [Y/n]: Y (Set a secure password here)
  • Remove anonymous users? [Y/n]: Y
  • Disallow root login remotely? [Y/n]: N
  • Remove test database and access to it? [Y/n]: Y
  • Reload privilege tables now? [Y/n]: Y

 

Step 13: Edit MySQL Default Configuration

Open the MySQL configuration file and adjust settings for character encoding:

sudo nano /etc/mysql/my.cnf

Add the following block of code to ensure proper character handling:

[mysqld]
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
[mysql]
default-character-set = utf8mb4

Save and close the file (Ctrl + X, then Y, then Enter).

 

Step 14: Restart MySQL Service

Apply the configuration changes by restarting the MySQL service:

sudo service mysql restart

 

Step 15: Install CURL, Node.js, NPM, and Yarn

Now install curl and Node.js, which are needed to run JavaScript dependencies for Frappe.

sudo apt install curl
curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
nvm install 18

Next, install NPM and Yarn (a package manager used for managing front-end dependencies):

sudo apt-get install npm
sudo npm install -g yarn

 

Step 16: Install Frappe Bench

Frappe Bench is a command-line tool that helps manage Frappe/ERPNext applications.

sudo pip3 install frappe-bench

 

Step 17: Initialize Frappe Bench

Now initialize Frappe Bench in the current directory, specifying the branch for Frappe 15:

bench init --frappe-branch version-15 frappe-bench

This will take some time, as it downloads and installs all the dependencies required for Frappe 15.

 

Step 18: Switch to the Frappe Bench Directory

Navigate to the newly created frappe-bench directory:

cd frappe-bench

 

Step 19: Create a New Site

Now create a new Frappe site where ERPNext will be installed:

bench new-site localhost

This command will set up a fresh Frappe site. You will be prompted to set the MySQL root password and administrator password for the site.

 

Step 20: Install ERPNext and Other Apps

Once the site is created, install ERPNext and other necessary apps:

bench get-app --branch version-15 erpnext
bench --site localhost install-app erpnext

You can also install additional apps, such as HRMS:

bench get-app --branch version-15 hrms
bench --site localhost install-app hrms

For apps hosted on GitHub or GitLab, you can install them by specifying the repository URL:

bench --site localhost <GitHub or GitLab link>

 

Step 21: Start the Server

Finally, start the Frappe development server:

bench start

Visit http://localhost:8000 in your browser to access your Frappe and ERPNext installation. Use the admin credentials you set during site creation to log in.

 

Final Thoughts

Implementing Frappe and ERPNext can significantly enhance your business operations by providing an integrated platform for managing various aspects of your organization. With the flexibility to customize and extend functionalities, you can tailor the system to align perfectly with your business processes. Regular maintenance, updates, and community engagement will ensure that your ERP system remains robust, secure, and efficient.

Thank you for following this step-by-step guide. We hope it has been helpful in setting up your ERPNext environment. Should you encounter any challenges or have further questions, don't hesitate to reach out to the vibrant Frappe and ERPNext communities or consult the official documentation for more detailed information.

Happy managing!

Category: ERP Solutions
Banner

Don't just hire talent,
But build your dream team

Our experience in providing the best talents in accordance with diverse industry demands sets us apart from the rest. Hire a dedicated team of experts to build & scale your project, achieve delivery excellence, and maximize your returns. Rest assured, we will help you start and launch your project, your way – with full trust and transparency!