@@ -1,3 +1,5 @@ | |||||
# Diagnosing The Scheduler | |||||
<!-- markdown --> | <!-- markdown --> | ||||
If you're experiencing delays in scheduled jobs or they don't seem to run, you can run the several commands to diagnose the issue. | If you're experiencing delays in scheduled jobs or they don't seem to run, you can run the several commands to diagnose the issue. | ||||
@@ -1 +1,5 @@ | |||||
# Guides | |||||
{index} | {index} |
@@ -1,3 +1,5 @@ | |||||
# Manual Setup | |||||
Manual Setup | Manual Setup | ||||
-------------- | -------------- | ||||
@@ -1,3 +1,5 @@ | |||||
# Setup Multitenancy | |||||
Assuming that you've already got your first site running and you've performed | Assuming that you've already got your first site running and you've performed | ||||
the [production deployment steps](setup-production.html), this section explains how to host your second | the [production deployment steps](setup-production.html), this section explains how to host your second | ||||
site (and more). Your first site is automatically set as default site. You can | site (and more). Your first site is automatically set as default site. You can | ||||
@@ -1,3 +1,5 @@ | |||||
# Setup Production | |||||
You can setup the bench for production use by configuring two programs, Supervisor and nginx. If you want to revert your Production Setup to Development Setup refer to [these commands](https://github.com/frappe/bench/wiki/Stopping-Production-and-starting-Development) | You can setup the bench for production use by configuring two programs, Supervisor and nginx. If you want to revert your Production Setup to Development Setup refer to [these commands](https://github.com/frappe/bench/wiki/Stopping-Production-and-starting-Development) | ||||
####Easy Production Setup | ####Easy Production Setup | ||||
@@ -1 +1,2 @@ | |||||
{index} | |||||
# Bench | |||||
@@ -1,3 +1,5 @@ | |||||
# Background Services | |||||
External services | External services | ||||
----------------- | ----------------- | ||||
@@ -1,3 +1,5 @@ | |||||
# Bench Commands Cheatsheet | |||||
### General Usage | ### General Usage | ||||
* `bench --version` - Show bench version | * `bench --version` - Show bench version | ||||
* `bench src` - Show bench repo directory | * `bench src` - Show bench repo directory | ||||
@@ -1,3 +1,5 @@ | |||||
# Bench Procfile | |||||
`bench start` uses [honcho](http://honcho.readthedocs.org) to manage multiple processes in **developer mode**. | `bench start` uses [honcho](http://honcho.readthedocs.org) to manage multiple processes in **developer mode**. | ||||
### Processes | ### Processes | ||||
@@ -1 +1,5 @@ | |||||
# Resources | |||||
{index} | {index} |
@@ -1,3 +1,5 @@ | |||||
# Adding Custom Button To Form | |||||
To create a custom button on your form, you need to edit the javascript file associated to your doctype. For example, If you want to add a custom button to User form then you must edit `user.js`. | To create a custom button on your form, you need to edit the javascript file associated to your doctype. For example, If you want to add a custom button to User form then you must edit `user.js`. | ||||
In this file, you need to write a new method `add_custom_button` which should add a button to your form. | In this file, you need to write a new method `add_custom_button` which should add a button to your form. | ||||
@@ -1,3 +1,5 @@ | |||||
# Adding Module Icons On Desktop | |||||
To create a module icon for a Page, List or Module, you will have to edit the `config/desktop.py` file in your app. | To create a module icon for a Page, List or Module, you will have to edit the `config/desktop.py` file in your app. | ||||
In this file you will have to write the `get_data` method that will return a dict object with the module icon parameters | In this file you will have to write the `get_data` method that will return a dict object with the module icon parameters | ||||
@@ -1,3 +1,5 @@ | |||||
# Custom Module Icon | |||||
If you want to create a custom icon for your module, you will have to create an SVG file for your module and set the path to this file in the `desktop/config.py` of your app.<br> | If you want to create a custom icon for your module, you will have to create an SVG file for your module and set the path to this file in the `desktop/config.py` of your app.<br> | ||||
This icon is loaded via AJAX first time, then it will be rendered. | This icon is loaded via AJAX first time, then it will be rendered. | ||||
@@ -1,3 +1,5 @@ | |||||
# Dialogs Types | |||||
Frappe provide a group of standard dialogs that are very usefull while coding. | Frappe provide a group of standard dialogs that are very usefull while coding. | ||||
## Alert Dialog | ## Alert Dialog | ||||
@@ -1,3 +1,5 @@ | |||||
# Executing Code On Doctype Events | |||||
To execute code when a DocType is inserted, validated (before saving), updated, submitted, cancelled, deleted, you must write in the DocType's controller module. | To execute code when a DocType is inserted, validated (before saving), updated, submitted, cancelled, deleted, you must write in the DocType's controller module. | ||||
#### 1. Controller Module | #### 1. Controller Module | ||||
@@ -1,3 +1,5 @@ | |||||
# How Enable Developer Mode In Frappe | |||||
When you are in application design mode and you want the changes in your DocTypes, Reports etc to affect the app repository, you must be in **Developer Mode**. | When you are in application design mode and you want the changes in your DocTypes, Reports etc to affect the app repository, you must be in **Developer Mode**. | ||||
To enable developer mode, update the `site_config.json` file of your site in the sites folder for example: | To enable developer mode, update the `site_config.json` file of your site in the sites folder for example: | ||||
@@ -1,3 +1,5 @@ | |||||
# How To Create Custom Fields During App Installation | |||||
Your custom app can automatically add **Custom Fields** to DocTypes outside of your app when it is installed to a new site. | Your custom app can automatically add **Custom Fields** to DocTypes outside of your app when it is installed to a new site. | ||||
To do this, add the new custom fields that your app requires, using the Frappe web application. | To do this, add the new custom fields that your app requires, using the Frappe web application. | ||||
@@ -1,3 +1,5 @@ | |||||
# How To Improve A Standard Control | |||||
Frappé has a couple of elegant and useful widgets, but some times we need to edit them to add small improvements. This small article will describe how to add new resources to the standard widgets. | Frappé has a couple of elegant and useful widgets, but some times we need to edit them to add small improvements. This small article will describe how to add new resources to the standard widgets. | ||||
Let me explain first our goal: | Let me explain first our goal: | ||||
@@ -1,3 +1,5 @@ | |||||
# Insert A Document Via Api | |||||
You can insert documents via a script using the `frappe.get_doc` method | You can insert documents via a script using the `frappe.get_doc` method | ||||
### Examples: | ### Examples: | ||||
@@ -1,3 +1,5 @@ | |||||
# Overriding Link Query By Custom Script | |||||
You can override the standard link query by using `set_query` | You can override the standard link query by using `set_query` | ||||
### 1. Adding Fitlers | ### 1. Adding Fitlers | ||||
@@ -1,3 +1,5 @@ | |||||
# Running Background Jobs | |||||
Sometimes you may not want a user request to be executed immediately but added to a queue that will be executed by a background worker. The advantage of doing this is that your web workers remain free to execute other requests and longer jobs do not eat up all of your resources. | Sometimes you may not want a user request to be executed immediately but added to a queue that will be executed by a background worker. The advantage of doing this is that your web workers remain free to execute other requests and longer jobs do not eat up all of your resources. | ||||
From version 7, Frappe uses Python RQ to run background jobs. | From version 7, Frappe uses Python RQ to run background jobs. | ||||
@@ -1,3 +1,5 @@ | |||||
# Single Type Doctype | |||||
DocTypes have a table associated with them. For example DocType **Customer** will have a table `tabCustomer` associated with it. | DocTypes have a table associated with them. For example DocType **Customer** will have a table `tabCustomer` associated with it. | ||||
**Single** type DocTypes have no table associated and there is only one Document for it. This is similar to the Singleton pattern in Java. Single DocTypes are ideal for saving Settings (that are globally applicable) and for wizard / helper type forms that have no documents, but when the DocType is used for the Form UI. | **Single** type DocTypes have no table associated and there is only one Document for it. This is similar to the Singleton pattern in Java. Single DocTypes are ideal for saving Settings (that are globally applicable) and for wizard / helper type forms that have no documents, but when the DocType is used for the Form UI. | ||||
@@ -1,3 +1,5 @@ | |||||
# Trigger Event On Deletion Of Grid Row | |||||
To trigger an event when a row from a Child Table has been deleted (when user clicks on `delete` button), you need to add a handler the `fieldname_remove` event to Child Table, where fieldname is the fieldname of the Child Table in Parent Table declaration. | To trigger an event when a row from a Child Table has been deleted (when user clicks on `delete` button), you need to add a handler the `fieldname_remove` event to Child Table, where fieldname is the fieldname of the Child Table in Parent Table declaration. | ||||
For example: | For example: | ||||
@@ -1,3 +1,5 @@ | |||||
# Using Html Templates In Javascript | |||||
Often while building javascript interfaces, there is a need to render DOM as an HTML template. Frappe Framework uses John Resig's Microtemplate script to render HTML templates in the Desk application. | Often while building javascript interfaces, there is a need to render DOM as an HTML template. Frappe Framework uses John Resig's Microtemplate script to render HTML templates in the Desk application. | ||||
> Note 1: In Frappe we use the Jinja-like `{% raw %}{%{% endraw %}` tags to embed code rather than the standard `<%` | > Note 1: In Frappe we use the Jinja-like `{% raw %}{%{% endraw %}` tags to embed code rather than the standard `<%` | ||||
@@ -1,3 +1,5 @@ | |||||
# Frappe Ajax Call | |||||
In Frappe Framework, you can manage ajax calls via frappe.call. The frappe.call works in asynchronous manner ie. send requests and handle response via callback mechanism. | In Frappe Framework, you can manage ajax calls via frappe.call. The frappe.call works in asynchronous manner ie. send requests and handle response via callback mechanism. | ||||
## frappe.call Structure | ## frappe.call Structure | ||||
@@ -1,3 +1,5 @@ | |||||
# Translations | |||||
<!-- jinja --> | <!-- jinja --> | ||||
<!-- static --> | <!-- static --> | ||||
@@ -1,3 +1,5 @@ | |||||
# Import Large Csv File | |||||
To import very large CSV files, you can use the bench utility `import-csv`. | To import very large CSV files, you can use the bench utility `import-csv`. | ||||
The benefit is that this is not subject to timeouts if you use the web interface. | The benefit is that this is not subject to timeouts if you use the web interface. | ||||
@@ -1,3 +1,5 @@ | |||||
# Email Notifications For Failed Background Jobs | |||||
<!-- markdown --> | <!-- markdown --> | ||||
<p>Frappe handles failure of jobs in the following way,</p><p>1) If a job fails, (raises exception), it's logged in Scheduler Log and <code>logs/worker.error.log</code>.<br>2) Keeps a lock file and would not run anymore if lock file is there.<br>3) Raises LockTimeoutError in case the lock file is more than 10 minutes old.</p> | <p>Frappe handles failure of jobs in the following way,</p><p>1) If a job fails, (raises exception), it's logged in Scheduler Log and <code>logs/worker.error.log</code>.<br>2) Keeps a lock file and would not run anymore if lock file is there.<br>3) Raises LockTimeoutError in case the lock file is more than 10 minutes old.</p> | ||||
@@ -1,3 +1,5 @@ | |||||
# How To Enable Social Logins | |||||
Use Facebook, Google or GitHub authentication to login to Frappe, and your users will be spared from remembering another password. | Use Facebook, Google or GitHub authentication to login to Frappe, and your users will be spared from remembering another password. | ||||
The system uses the **Email Address** supplied by these services to **match with an existing user** in Frappe. If no such user is found, **a new user is created** of the default type **Website User**, if Signup is not disabled in Website Settings. Any System Manager can later change the user type from **Website User** to **System User**, so that the user can access the Desktop. | The system uses the **Email Address** supplied by these services to **match with an existing user** in Frappe. If no such user is found, **a new user is created** of the default type **Website User**, if Signup is not disabled in Website Settings. Any System Manager can later change the user type from **Website User** to **System User**, so that the user can access the Desktop. | ||||
@@ -1,3 +1,5 @@ | |||||
# How To Migrate Doctype Changes To Production | |||||
#### 1. DocType / Schema Changes | #### 1. DocType / Schema Changes | ||||
If you are in `developer_mode`, the `.json` files for each **DocType** are automatically updated. | If you are in `developer_mode`, the `.json` files for each **DocType** are automatically updated. | ||||
@@ -1,3 +1,5 @@ | |||||
# Formatter For Link Fields | |||||
In case where a code and a name is maintained for an entity, (for example for Employee there may be an Employee Code and Employee Name) and we want to show both the ID and name in a link field, we can make a formatter. | In case where a code and a name is maintained for an entity, (for example for Employee there may be an Employee Code and Employee Name) and we want to show both the ID and name in a link field, we can make a formatter. | ||||
#### Example: | #### Example: | ||||
@@ -13,7 +13,7 @@ Either file must be present for the system to make this a valid folder to build | |||||
### Markdown | ### Markdown | ||||
# This is a title | # This is a title | ||||
This is some page content | This is some page content | ||||
a [link](/link/to/page) | a [link](/link/to/page) | ||||
@@ -1,3 +1,5 @@ | |||||
# Getting Information From Another Document In Print Format | |||||
In a print format, you can get data from another document. For example in if you have a fields called `sales_order` in Sales Invoice, then you can get the sales order details using `frappe.get_doc`: | In a print format, you can get data from another document. For example in if you have a fields called `sales_order` in Sales Invoice, then you can get the sales order details using `frappe.get_doc`: | ||||
{% raw %} | {% raw %} | ||||
@@ -1,3 +1,5 @@ | |||||
# How To Make Query Report | |||||
You can create tabulated reports using complex SQL queries by creating a new Report. These reports can be created by a System Manager and are stored in the Database | You can create tabulated reports using complex SQL queries by creating a new Report. These reports can be created by a System Manager and are stored in the Database | ||||
> Note: You will need System Manager Permissions for this. | > Note: You will need System Manager Permissions for this. | ||||
@@ -1,3 +1,5 @@ | |||||
# Where Do I Find Standard Print Formats | |||||
Standard Print formats are <b>auto generated</b> from the layout of the DocType. You can customize the standard format by | Standard Print formats are <b>auto generated</b> from the layout of the DocType. You can customize the standard format by | ||||
<br> | <br> | ||||
<br> | <br> | ||||
@@ -1,3 +1,5 @@ | |||||
# Form Client Scripting | |||||
## Scripting Forms | ## Scripting Forms | ||||
Now we have created a basic system that works out of the box without us having to write any code. Let us now write some scripts to make the application richer and add validations so that the user does not enter wrong data. | Now we have created a basic system that works out of the box without us having to write any code. Let us now write some scripts to make the application richer and add validations so that the user does not enter wrong data. | ||||
@@ -1,3 +1,5 @@ | |||||
# Diagnosing The Scheduler | |||||
<!-- markdown --> | <!-- markdown --> | ||||
En caso que estes experimentando inconvenientes con las tareas programadas, puedes ejecutar varios comandos para diagnosticar el problema. | En caso que estes experimentando inconvenientes con las tareas programadas, puedes ejecutar varios comandos para diagnosticar el problema. | ||||
@@ -1 +1,5 @@ | |||||
# Guides | |||||
{index} | {index} |
@@ -1,3 +1,5 @@ | |||||
# Manual Setup | |||||
Instalación Manual | Instalación Manual | ||||
-------------- | -------------- | ||||
@@ -1,3 +1,5 @@ | |||||
# Setup Multitenancy | |||||
Asumiento que tiene su primer site corriendo y ha realizado los | Asumiento que tiene su primer site corriendo y ha realizado los | ||||
[pasos para producción](setup-production.html), esta sección explica como montar su segundo site (y más). | [pasos para producción](setup-production.html), esta sección explica como montar su segundo site (y más). | ||||
Su primer site se configuró como el site por defecto de forma automática. Puedes cambiarlo ejecutando el comando, | Su primer site se configuró como el site por defecto de forma automática. Puedes cambiarlo ejecutando el comando, | ||||
@@ -1,3 +1,5 @@ | |||||
# Setup Production | |||||
Puedes configurar el bench para producción configurando dos parametros, Supervisor y nginx. Si quieres volver a ponerlo en desarrollo debes ver [estos comandos](https://github.com/frappe/bench/wiki/Stopping-Production-and-starting-Development) | Puedes configurar el bench para producción configurando dos parametros, Supervisor y nginx. Si quieres volver a ponerlo en desarrollo debes ver [estos comandos](https://github.com/frappe/bench/wiki/Stopping-Production-and-starting-Development) | ||||
####Configuración para producción facíl | ####Configuración para producción facíl | ||||
@@ -1 +1,5 @@ | |||||
# Bench | |||||
{index} | {index} |
@@ -1,3 +1,5 @@ | |||||
# Background Services | |||||
Servicios Externos | Servicios Externos | ||||
----------------- | ----------------- | ||||
@@ -1,3 +1,5 @@ | |||||
# Bench Commands Cheatsheet | |||||
### Uso General | ### Uso General | ||||
* `bench --version` - Muestra la versión del bench | * `bench --version` - Muestra la versión del bench | ||||
* `bench src` - Muestra el directorio repo del bench | * `bench src` - Muestra el directorio repo del bench | ||||
@@ -1,3 +1,5 @@ | |||||
# Bench Procfile | |||||
`bench start` usa [honcho](http://honcho.readthedocs.org) para manejar múltiples procesos en **developer mode**. | `bench start` usa [honcho](http://honcho.readthedocs.org) para manejar múltiples procesos en **developer mode**. | ||||
### Procesos | ### Procesos | ||||
@@ -1 +1,5 @@ | |||||
# Resources | |||||
{index} | {index} |
@@ -1,3 +1,5 @@ | |||||
# Form Client Scripting | |||||
## Añadir Scripts a nuestros formularios | ## Añadir Scripts a nuestros formularios | ||||
Ya que tenemos creado el sistema básico que funciona sin problemas sin escribir una linea de código. Vamos a escribir algunos scripts | Ya que tenemos creado el sistema básico que funciona sin problemas sin escribir una linea de código. Vamos a escribir algunos scripts | ||||
@@ -1,3 +1,5 @@ | |||||
# Form Client Scripting | |||||
## Codes des formulaires | ## Codes des formulaires | ||||
Jusqu'a maintenant, nous avons développé un système basique qui fonctionne parfaitement sans avoir eu besoin d'écrire une | Jusqu'a maintenant, nous avons développé un système basique qui fonctionne parfaitement sans avoir eu besoin d'écrire une | ||||
@@ -1,3 +1,5 @@ | |||||
# Form Client Scripting | |||||
## Escrevendo script de formulários | ## Escrevendo script de formulários | ||||
Até agora nós criamos um sistema básico que funciona fora da caixa, sem ter que escrever nenhum código. Vamos agora escrever alguns scripts para tornar a aplicação mais rica e adicionar validações de formulários para o usuário não inserir dados incorretos. | Até agora nós criamos um sistema básico que funciona fora da caixa, sem ter que escrever nenhum código. Vamos agora escrever alguns scripts para tornar a aplicação mais rica e adicionar validações de formulários para o usuário não inserir dados incorretos. | ||||
@@ -1,8 +1,18 @@ | |||||
''' | |||||
Check for unused CSS Classes | |||||
sUpdate source and target apps below and run from CLI | |||||
bench --site [sitename] execute frappe.website.purifycss.purify.css | |||||
''' | |||||
import frappe, re, os | import frappe, re, os | ||||
source = frappe.get_app_path('frappe_theme', 'public', 'less', 'frappe_theme.less') | |||||
target_apps = ['erpnext_com', 'frappe_io', 'translator', 'chart_of_accounts_builder', 'frappe_theme'] | |||||
def purifycss(): | def purifycss(): | ||||
source = frappe.get_app_path('frappe_theme', 'public', 'less', 'frappe_theme.less') | |||||
target_apps = ['erpnext_com', 'frappe_io', 'translator', 'chart_of_accounts_builder', 'frappe_theme'] | |||||
with open(source, 'r') as f: | with open(source, 'r') as f: | ||||
src = f.read() | src = f.read() | ||||
@@ -285,3 +285,24 @@ def extract_title(source, path): | |||||
title = os.path.basename(path.rsplit('.', )[0].rstrip('/')).replace('_', ' ').replace('-', ' ').title() | title = os.path.basename(path.rsplit('.', )[0].rstrip('/')).replace('_', ' ').replace('-', ' ').title() | ||||
return title | return title | ||||
def add_missing_headers(): | |||||
'''Walk and add missing headers in docs (to be called from bench execute)''' | |||||
path = frappe.get_app_path('erpnext', 'docs') | |||||
for basepath, folders, files in os.walk(path): | |||||
for fname in files: | |||||
if fname.endswith('.md'): | |||||
with open(os.path.join(basepath, fname), 'r') as f: | |||||
content = frappe.as_unicode(f.read()) | |||||
if not content.startswith('# ') and not '<h1>' in content: | |||||
with open(os.path.join(basepath, fname), 'w') as f: | |||||
if fname=='index.md': | |||||
fname = os.path.basename(basepath) | |||||
else: | |||||
fname = fname[:-3] | |||||
h = fname.replace('_', ' ').replace('-', ' ').title() | |||||
print h | |||||
content = '# {0}\n\n'.format(h) + content | |||||
f.write(content.encode('utf-8')) | |||||