mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-12 03:15:07 +00:00
[docs] moved into folders
This commit is contained in:
177
docs/dev/docs.dev.api.md
Normal file
177
docs/dev/docs.dev.api.md
Normal file
@@ -0,0 +1,177 @@
|
||||
---
|
||||
{
|
||||
"_label": "Web Service API"
|
||||
}
|
||||
---
|
||||
All communication with the ERPNext server happens via web services using HTTP requests and passing data via JSON (Javascript Object Notation). Using web requests you can insert, update, query, run public triggers etc. The basic scheme is as follows:
|
||||
|
||||
1. All API calls are to me made to `server.py` on your public folder of your erpnext account. For hosted users, it is (yourdomain.erpnext.com).
|
||||
1. The `cmd` parameter points to the python function to be executed.
|
||||
1. Authentication is managed using cookies.
|
||||
|
||||
### Authentication
|
||||
|
||||
Authentication is done via the login method:
|
||||
|
||||
GET server.py?cmd=login&usr=[username]&password=[password]
|
||||
|
||||
The login method returns a session id `sid` cookie in the header and a status in the
|
||||
body of the request. The `sid` cookie must be sent for each subsequent request.
|
||||
|
||||
Example:
|
||||
|
||||
$ curl -I http://localhost/webnotes/erpnext/public/server.py?cmd=login\&usr=Administrator\&pwd=admin
|
||||
HTTP/1.1 200 OK
|
||||
Date: Tue, 23 Jul 2013 05:29:24 GMT
|
||||
Server: Apache/2.2.22 (Unix) DAV/2 mod_ssl/2.2.22 OpenSSL/0.9.8r
|
||||
Set-Cookie: country=None
|
||||
Set-Cookie: sid=d0ce00d49c24869984960607a2467b50ff59b0024741922db4b23818; expires=Fri, 26 Jul 2013 10:59:25
|
||||
Content-Length: 32
|
||||
Content-Type: text/html; charset: utf-8
|
||||
|
||||
{"message":"Logged In","exc":""}
|
||||
|
||||
$ curl http://localhost/webnotes/erpnext/public/server.py?cmd=webnotes.client.get\&doctype=Profile\&name=Administrator -b sid=d0ce00d49c24869984960607a2467b50ff59b0024741922db4b23818
|
||||
|
||||
{
|
||||
"message":[
|
||||
{
|
||||
"user_image":null,
|
||||
"last_name":"User",
|
||||
"last_ip":"::1",
|
||||
..
|
||||
..
|
||||
### Python Remote Client
|
||||
|
||||
You can use the `webclient.py` module as an example of how to access data using the webservice API
|
||||
|
||||
- [Code](https://github.com/webnotes/wnframework/blob/master/webnotes/utils/webclient.py)
|
||||
- [Docs](http://erpnext.org/docs.dev.framework.server.webnotes.utils.webclient.html)
|
||||
|
||||
### Passing and Receiving Documents (`doclist`)
|
||||
|
||||
To insert or update documents in ERPNext you have to pass them as a JSON Object. The structure of a Document is a list of plain objects (called `doclist`). The `doclist`
|
||||
contains the the parent document and any child documents (if they are present).
|
||||
|
||||
Example:
|
||||
|
||||
[{
|
||||
"doctype": "Parent"
|
||||
"key1": "value1"
|
||||
..
|
||||
},{
|
||||
"doctype": "Child",
|
||||
"parenttype": "Parent",
|
||||
"parentfield": "children",
|
||||
"key1", "value1",
|
||||
..
|
||||
}]
|
||||
|
||||
### webnotes.client
|
||||
|
||||
`webnotes.client` is the easiest way to interact with the ERPNext Server. It contains
|
||||
a bunch of server-side public methods that can be used by any client.
|
||||
|
||||
- [Code](https://github.com/webnotes/wnframework/blob/master/webnotes/client.py)
|
||||
- [Docs](http://erpnext.org/docs.dev.framework.server.webnotes.client.html)
|
||||
|
||||
### Example
|
||||
|
||||
Here is an example how you can use the webclient module to insert a new Sales Invoice
|
||||
in ERPNext.
|
||||
|
||||
from webclient import *
|
||||
|
||||
server = "http://myaccount.erpnext.com/server.py"
|
||||
user = "your user name"
|
||||
password = "your password"
|
||||
|
||||
login()
|
||||
|
||||
customer = get_doc("Customer", customer_name)
|
||||
|
||||
# make customer if required
|
||||
if not customer:
|
||||
response = insert([{
|
||||
"doctype":"Customer",
|
||||
"customer_name": customer_name,
|
||||
"customer_type": "Company",
|
||||
"customer_group": "Standard Group",
|
||||
"territory": "Default",
|
||||
"customer_details": "some unique info",
|
||||
"company": "Alpha"
|
||||
}])
|
||||
|
||||
# make invoice
|
||||
resonse = insert([
|
||||
# main
|
||||
{
|
||||
"naming_series": "_T-Sales Invoice-",
|
||||
"company": "_Test Company",
|
||||
"conversion_rate": 1.0,
|
||||
"currency": "INR",
|
||||
"debit_to": "_Test Customer - _TC",
|
||||
"customer": "_Test Customer",
|
||||
"customer_name": "_Test Customer",
|
||||
"doctype": "Sales Invoice",
|
||||
"due_date": "2013-01-23",
|
||||
"fiscal_year": "_Test Fiscal Year 2013",
|
||||
"grand_total": 561.8,
|
||||
"grand_total_export": 561.8,
|
||||
"net_total": 500.0,
|
||||
"plc_conversion_rate": 1.0,
|
||||
"posting_date": "2013-01-23",
|
||||
"price_list_currency": "INR",
|
||||
"selling_price_list": "_Test Price List",
|
||||
"territory": "_Test Territory"
|
||||
},
|
||||
|
||||
# items
|
||||
{
|
||||
"amount": 500.0,
|
||||
"basic_rate": 500.0,
|
||||
"description": "138-CMS Shoe",
|
||||
"doctype": "Sales Invoice Item",
|
||||
"export_amount": 500.0,
|
||||
"export_rate": 500.0,
|
||||
"income_account": "Sales - _TC",
|
||||
"cost_center": "_Test Cost Center - _TC",
|
||||
"item_name": "138-CMS Shoe",
|
||||
"parentfield": "entries",
|
||||
"qty": 1.0
|
||||
},
|
||||
|
||||
# taxes
|
||||
{
|
||||
"account_head": "_Test Account VAT - _TC",
|
||||
"charge_type": "On Net Total",
|
||||
"description": "VAT",
|
||||
"doctype": "Sales Taxes and Charges",
|
||||
"parentfield": "other_charges",
|
||||
"tax_amount": 30.0,
|
||||
},
|
||||
{
|
||||
"account_head": "_Test Account Service Tax - _TC",
|
||||
"charge_type": "On Net Total",
|
||||
"description": "Service Tax",
|
||||
"doctype": "Sales Taxes and Charges",
|
||||
"parentfield": "other_charges",
|
||||
"tax_amount": 31.8,
|
||||
},
|
||||
|
||||
# sales team
|
||||
{
|
||||
"parentfield": "sales_team",
|
||||
"doctype": "Sales Team",
|
||||
"sales_person": "_Test Sales Person 1",
|
||||
"allocated_percentage": 65.5,
|
||||
},
|
||||
{
|
||||
"parentfield": "sales_team",
|
||||
"doctype": "Sales Team",
|
||||
"sales_person": "_Test Sales Person 2",
|
||||
"allocated_percentage": 34.5,
|
||||
},
|
||||
)]
|
||||
|
||||
|
||||
10
docs/dev/docs.dev.client_script.md
Normal file
10
docs/dev/docs.dev.client_script.md
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
{
|
||||
"_label": "Client Scripts: Custoimzing ERPNext"
|
||||
|
||||
}
|
||||
---
|
||||
|
||||
|
||||
|
||||
|
||||
46
docs/dev/docs.dev.docs.md
Normal file
46
docs/dev/docs.dev.docs.md
Normal file
@@ -0,0 +1,46 @@
|
||||
---
|
||||
{
|
||||
"_label": "How to Build ERPNext Documentation"
|
||||
}
|
||||
---
|
||||
This page explains how to build the ERPNext documentation.
|
||||
|
||||
The documentation sources are in the [`docs` folder of the erpnext repository](https://github.com/webnotes/erpnext/tree/master/docs). The source files are in markdown format and they have a custom header that is separated by `---`
|
||||
|
||||
## Documentation Header
|
||||
|
||||
The header contains the title of the page and sub pages (table of contents) in any. Example of a simple header with title is:
|
||||
|
||||
---
|
||||
{
|
||||
"_label": "How to Build ERPNext Documentation"
|
||||
}
|
||||
---
|
||||
|
||||
#### Adding Table of Contents
|
||||
|
||||
Table of contents is added by setting the `_toc` property as below:
|
||||
|
||||
---
|
||||
{
|
||||
"_label": "Developer",
|
||||
"_toc": [
|
||||
"docs.dev.install",
|
||||
"docs.dev.quickstart",
|
||||
"docs.dev.framework",
|
||||
"docs.dev.api",
|
||||
"docs.dev.modules",
|
||||
"docs.dev.translate"
|
||||
]
|
||||
}
|
||||
---
|
||||
|
||||
## Building the Output pages
|
||||
|
||||
Once the sources have been edited / updated, to build the documentation, login into your local ERPNext account.
|
||||
|
||||
1. Open __Documenation Tool__ by adding `#Form/Documentation Tool` to the address bar.
|
||||
1. Check on all the pages to be generated
|
||||
1. Click on "Make Docs"
|
||||
|
||||
All the output pages are generated in the `public/docs` folder
|
||||
41
docs/dev/docs.dev.install.md
Normal file
41
docs/dev/docs.dev.install.md
Normal file
@@ -0,0 +1,41 @@
|
||||
---
|
||||
{
|
||||
"_label": "How to Install ERPNext",
|
||||
"_toc": [
|
||||
"docs.dev.install.restore_from_backup"
|
||||
]
|
||||
}
|
||||
---
|
||||
|
||||
> These are instructions that will help you to install ERPNext on your Unix like system (Linux / Ubuntu / MacOS) using the Terminal. If you are looking at easier ways to evaluate ERPNext, [see this page](docs.user.intro.try.html).
|
||||
|
||||
### ERPNext Installer (Beta)
|
||||
|
||||
Install ERPNext in one command!
|
||||
|
||||
1. Switch to root user using `sudo su`
|
||||
1. Create a folder where you want to install erpnext
|
||||
1. Go to the new folder
|
||||
1. `wget https://raw.github.com/webnotes/erpnext/master/install_erpnext.py`
|
||||
1. `python install_erpnext.py`
|
||||
|
||||
> If you are installing on your server for deployment, remember to change Administrator's password!
|
||||
|
||||
> If you get stuck, post your questions at [ERPNext Developer Forum](https://groups.google.com/forum/#!forum/erpnext-developer-forum)
|
||||
|
||||
> [Troubleshooting SELinux](http://www.crypt.gen.nz/selinux/disable_selinux.html)
|
||||
|
||||
--
|
||||
|
||||
> [Server Setup Tips](http://plusbryan.com/my-first-5-minutes-on-a-server-or-essential-security-for-linux-servers)
|
||||
|
||||
> [MySQL configuration file - my.cnf](https://github.com/webnotes/erpnext/wiki/MySQL-configuration-file)
|
||||
|
||||
> [Some Useful Aliases](https://github.com/webnotes/erpnext/wiki/Some-Useful-Aliases)
|
||||
|
||||
---
|
||||
### Upgrade / run latest patches
|
||||
|
||||
1. Backup your database!
|
||||
1. Go to Setup > Update ERPNext
|
||||
1. Click on 'Update'
|
||||
26
docs/dev/docs.dev.install.restore_from_backup.md
Normal file
26
docs/dev/docs.dev.install.restore_from_backup.md
Normal file
@@ -0,0 +1,26 @@
|
||||
---
|
||||
{
|
||||
"_label": "Restoring From ERPNext Backup"
|
||||
}
|
||||
---
|
||||
|
||||
* Download backup files
|
||||
|
||||
cd /tmp
|
||||
wget [DATABASE BACKUP FILE URL]
|
||||
wget [FILES BACKUP FILE URL]
|
||||
|
||||
* Suppose your backup files are downloaded at /tmp
|
||||
|
||||
gunzip [DATABASE BACKUP FILE.sql.gz]
|
||||
tar xvf [FILES BACKUP.tar]
|
||||
|
||||
* Go to your ERPNext installation folder
|
||||
* When restoring from database, the 'Administrator' user password gets reset to 'admin'. To set a better password when restoring, set admin_password variable in conf.py to the desired 'Administrator' user password.
|
||||
* Restore database using:
|
||||
|
||||
lib/wnf.py --install [DATABASE NAME] /tmp/[DATABASE BACKUP FILE.sql]
|
||||
|
||||
* Copy extracted files
|
||||
|
||||
cp /tmp/[FILES BACKUP EXTRACTED FOLDER/---/public/files/*] [YOUR ERPNEXT INSTALLATION]/public/files/
|
||||
20
docs/dev/docs.dev.md
Normal file
20
docs/dev/docs.dev.md
Normal file
@@ -0,0 +1,20 @@
|
||||
---
|
||||
{
|
||||
"_label": "Developer",
|
||||
"_toc": [
|
||||
"docs.dev.install",
|
||||
"docs.dev.quickstart",
|
||||
"docs.dev.framework",
|
||||
"docs.dev.modules",
|
||||
"docs.dev.client_script",
|
||||
"docs.dev.api",
|
||||
"docs.dev.translate",
|
||||
"docs.dev.docs"
|
||||
]
|
||||
}
|
||||
---
|
||||
### Is this for me?
|
||||
|
||||
To starting hacking into ERPNext, you must have some understanding of how a dynamic web application works. There are hundreds of architectures and frameworks to make web development easier, but at the core there are a few elements that are important to understand.
|
||||
|
||||
ERPNext is built on `wnframework` which is primarily developed for ERPNext but can be extended to make similar database driven applications. wnframework uses Python on the server-side and has a javascript based client for entering data, managing workflow and making reports.
|
||||
6
docs/dev/docs.dev.modules.md
Normal file
6
docs/dev/docs.dev.modules.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
{
|
||||
"_label": "Modules"
|
||||
}
|
||||
---
|
||||
The models used in both `wnframework` (**Core** module) and ERPNext are listed here. The basic element of the model is a `DocType`, which is most often also a database table. The model properties are called `DocFields`, which describe the view and the database columns.
|
||||
64
docs/dev/docs.dev.translate.md
Normal file
64
docs/dev/docs.dev.translate.md
Normal file
@@ -0,0 +1,64 @@
|
||||
---
|
||||
{
|
||||
"_label": "Managing Translations"
|
||||
}
|
||||
---
|
||||
This document shows how to translations are managed in ERPNext and how to add a new language or update translations of an existing language.
|
||||
|
||||
### Source
|
||||
|
||||
Translatable text exists in 3 main sources:
|
||||
|
||||
1. Javascript Code Files (both framework and application)
|
||||
1. Python Code Files
|
||||
1. DocTypes (names, labels and select options)
|
||||
|
||||
#### Strings in Code Files
|
||||
|
||||
Strings in code files are annotated using the `_` (underscore) method
|
||||
|
||||
1. In Python it is the `webnotes._` method. Example:
|
||||
|
||||
webnotes._("This string must be translated")
|
||||
|
||||
1. In Javascript it is the `wn._` method. Example:
|
||||
|
||||
`wn._("This string must be translated")`
|
||||
|
||||
### How Translations Are Picked up During Execution
|
||||
|
||||
When the __build__ (`lib/wnf.py -b`) process is run, along with generating the `public` folders, it will also add a `locale` folder in each folder where translations need to be applied. This `locale` folder is rebuilt every time new translations are made.
|
||||
|
||||
Based on the user preferences or request preferences, the appropriate translations are loaded at the time of request on the server side. Or if metadata (DocType) is queried, then the appropriate translations are appended when the DocType data is requested.
|
||||
|
||||
The underscore `_` method will replace the strings based on the available translations loaded at the time.
|
||||
|
||||
### Master Translations
|
||||
|
||||
Master translations are stored in the application (erpnext repository) in the `translations` folder. [Translations master folder](https://github.com/webnotes/erpnext/tree/master/translations)
|
||||
|
||||
These are built using the `webnotes.translate module` ([Docs](http://erpnext.org/docs.dev.framework.server.webnotes.translate.html) | [Code](https://github.com/webnotes/wnframework/blob/master/webnotes/translate.py)).
|
||||
|
||||
### Building Translations
|
||||
|
||||
Translations can be built using the `lib/wnf.py` utility. Do `lib/wnf.py --help` for more info.
|
||||
|
||||
> New translations are built using Google Translate API. As of the time of writing of this document, Google Translate API is not free. To build a translation of your own from Google, you will have to register with Google API and add your API key in `conf.py`
|
||||
|
||||
To add a new language just add:
|
||||
|
||||
1. Build new translation from Google: `lib/wnf.py --translate ru`
|
||||
1. Get user the ability to select this language: Go to #Form/DocType/Profile and update the options in `langauge` field.
|
||||
1. Map the language name to the abbreviation: Update `startup/__init__.py` ([Link](https://github.com/webnotes/erpnext/blob/master/startup/__init__.py))
|
||||
|
||||
### Updating Translations
|
||||
|
||||
#### Updating Sources:
|
||||
|
||||
If you find translatable strings are not properly annotated using the `_` method, you can add them in the code and rebuild the translations.
|
||||
|
||||
#### Improving Translations:
|
||||
|
||||
To improve an existing translation, just edit the master translation files in `app/translations` and rebuild using `lib/wnf.py -b`
|
||||
|
||||
> Please contribute your translations back to ERPNext by sending us a Pull Request.
|
||||
Reference in New Issue
Block a user