Showing posts with label ERPNext. Show all posts
Showing posts with label ERPNext. Show all posts

Thursday, 8 November 2018

Setting Custom Query in ERPNext

frappe.ui.form.on("Material Request", "onload", function(frm) {
    frm.set_query("item_code","items", function() {
        return {
            "query" : "custom_app.controllers.queries.custom_item_query",
            "filters": {
                "item_group": frm.doc.item_group
            }
        };
    });
});

CDROM error during sudo python install.py --develop

Edit /etc/apt/sources.list file and remove all lines having “cdrom”


ProgrammingError: (1146, "Table 'xxxxxxxxxxxxxxxxx.help' doesn't exist") while clicking Help > Documentation

Reason: Help Database not synchronized

Run the bench migrate command to sync the help database

bench.utils.CommandFailedError: git pull upstream develop

Reason: Pending git commits

==================================================================
Do the following if you haven't made local changes to files in the application:
go to folder /home/frappe/frappe-bench/apps/erpnext
and run the following command:

git reset --hard
git pull
go to folder /home/frappe/frappe-bench/apps/frappe
and run the following command:

git reset --hard
git pull
go to folder /home/frappe/.bench
and run the following command:

git reset --hard
git pull
Finally goto /home/frappe/frappe-bench
and run:

bench update

========================
Go to the directory, either frappe-bench/apps/erpnext or frappe-bench/apps/frappe
Type git status
Check the list of the untracked files. There might be files, which do or don't belong there.
Type git add --all to track those files
Type git stash
Run bench update
It should run successfully, if not, start over with 1. and repeat for the other directory

Create new Site in ERPNext

bench new-site <SITE NAME>
bench set-nginx-port <SITE NAME> <PORT NUMBER>
bench --site <SITE NAME> install-app erpnext
bench restart

Switch to Developer mode in ERPNext

Edit sites/common-site-config.json
Insert a row"developer_mode": 1

Edit sites/<site name>/ site-config.json
Insert a row
"developer_mode": 1

Restart bench
=========================================

bench set-config developer_mode 1
clear cache

Hide Dashboard in Documents in ERPNext

put this code in your custom script of that doctype
cur_frm.dashboard.frm.fields[0].df.collapsible=0

Create new DocType in ERPNext

In Doc Type, Create a new document type under any specific module

Edit ~/frappe-bench/apps/erpnext/erpnext/config/module.py


Under any specific Label (sub module), within "items", Insert

{
"type": "doctype",
"name": "doctype name",
},

ERPNext Backup

change to bench directory
erpnext@server:~$ cd frappe-bench/
erpnext@server:~/frappe-bench$

use command
erpnext@server:~/frappe-bench$ bench backup
or command
erpnext@server:~/frappe-bench$ bench backup-all-sites

your database backups will be in ~/frappe-bench/sites/[sitename]/private/backups/
check out for the most recent backup with current time, there may be backups there already.

Now take backups of files
erpnext@server:~/frappe-bench/sites/[sitename]/public$ tar cvf ~/[sitename]-files.tar files
2 Backup files:
1. Database backup
2. Files backup

Setup bench on other machine where you want to restore.
Extract files in appropriate site's sub directory ~/frappe-bench/sites/[sitename]/public
Restore database backup
erpnext@other-server:~/frappe-bench$ bench restore SQL_FILE_PATH

Install ERPNext in Ubuntu

SSH into the machine
  • login as “root”
Prerequisites
  • sudo apt-get update -y
  • #sudo apt-get upgrade -y
  • sudo apt-get install python3-minimal -y
  • sudo apt-get install build-essential python3-setuptools -y
  • sudo apt-get install build-essential libssl-dev libffi-dev python3-dev
  • sudo apt-get install python3-pip
  • python3 -m pip install --upgrade pip
Adding Frappe User as sudoer and switching into it
  • sudo adduser erpuser
  • usermod -aG sudo erpuser
  • su - erpuser
  • #cd /home/erpuser/
Easyinstaller
System Login
  • login as administrator/admin