Erpnext Customize Related Git and Upload
Erpnext Customize Related Git and Upload
custom fields
If you are looking to create a custom app to store custom fields and store this on GitHub (or
other online repositories), the following will take you through the process.
1. Setup GitHub
Although I am using GitHub, you should be able to follow this with other providers such
as BitBucket 4, GitLab 8, SourceForge 5, Launchpad 1 etc…
Next, lock your account down with 2FA (https://github.com/settings/security 36). Once you
have added 2fa, you should not need to use your password but instead create tokens for
applications to access your GitHub account. This is usefull if you want to temporarily give
someone access to your private repositry but don’t want to give them your master password
or provide 2fa codes.
Now create a token for using GIT (https://github.com/settings/tokens 42). Ensure the token
is only able to access the Repo only (repo:status, repo_deployment, public_repo, repo:invite).
Finally, create a new repository and make a note of the link which can be found on clicking
green “Clone or download” button. This should end with .git. Choose Private if you don’t
want the internet to see your code.
When choosing repository name, do not use dashes or spaces. If you want to space your
words, then use underscore (_).
2. Create App
Now we can create the app in Bench. Login to your erpnext and go to you ERPNext folder.
This will be the directory where bench/erpnext is installed into. For the purpose of following
this, I have created a user bench and installed erpnext into folder erpnext.
cd /home/bench/erpnext
App Title
App Description
App Publisher
App Email
App Icon
App Color
App License
Fixtures
fixtures = [‘Custom Field’]
Now we need to install the app onto your site: assuming your site is erpnext.domain.com 8
cd /home/bench/erpnext
3. Export Fixtures
Now we have the app installed, we want Bench to export the Custom Fields you have
created into the custom app. Please ensure your mysql is running
cd /home/bench/erpnext
bench export-fixtures
Now we need to push the app to GitHub. Don’t forget to change the username, email and
GitHub links when pasting into the shell.
cd /home/bench/erpnext/apps/erpnext_app
git init
git add .
You will be prompted for username and password. Enter your GitHub username and the
token created above.
You app should now be pushed to GitHub. You can double check this by going on the web
front end.
A. Updating App
You can edit your app using any tools and push these changes to GitHub. To incorporate
these changes to your ERPNext instance, simply go into the apps directory and issue a git
pull command:
cd /home/bench/erpnext/apps/erpnext_app
git pull
cd /home/bench/erpnext
Replace domain with your site erpnext.domain.com 8 with your site address.
cd /home/bench/erpnext
Thanks.