Difference between revisions of "Odoo"

From ArchWiki
Jump to: navigation, search
(additional settings)
m (Configuring Odoo to run with PostgreSQL: Fix typo)
 
(41 intermediate revisions by 13 users not shown)
Line 1: Line 1:
 
[[Category:Office]]
 
[[Category:Office]]
{{stub}}
+
[[ja:Odoo]]
 +
[https://www.odoo.com Odoo] (formerly known as OpenERP and before that, TinyERP) is a suite of open-source enterprise management applications. Targeting companies of all sizes, the application suite includes billing, accounting, manufacturing, purchasing, warehouse management, and project management.
  
=Introduction=
+
Odoo features an application server which uses PostgreSQL as database back-end, with a web-based client. Odoo is written in Python, with a highly modular design which allows rapid development of new modules through Open Object RAD. Odoo developers have a strong commitment to free software.
  
This introduction briefly describes [http://openerp.com/ Open ERP], its basic design, and its community. The rest of this article details installing and configuring Open ERP on Arch Linux. It also provides additional information about Open ERP documentation, community, and development.
+
A thriving support and development community has grown up around Odoo, providing free technical support, bug-fixing, new development, and support services. Odoo provides extensive documentation in various electronic formats, as well as hardcopy. The company responsible for development of Odoo earns profits through partnership services with Odoo consultants, and by providing support, training, hosting services, software development, and software quality testing and verification.
  
Open ERP is Enterprise Resource Planning software. It provides a complete, integrated ERP solution for small and medium sized businesses and organizations. Open ERP includes financial and analytic accounting, warehouse and inventory management, sales and purchase management, customer and supplier relations management, association management, tasks automation, human resource management, marketing campaign, document management, help desk, e-commerce integration, and point of sale functionality.
+
== Installation ==
  
Open ERP features an application server which uses PostgreSQL for its database, with a web-based client. It is written in the Python programming language, with a highly modular design which allows for the rapid development of new modules through Open Object RAD. Open ERP developers have a strong committment to free software.
+
=== Installing Odoo ===
  
A thriving support and development community has grown up around Open ERP, providing free technical support, bugfixing, new development, and support services. Open ERP provides extensive documentation in various electronic formats, as well as hardcopy. The company responsible for development of Open ERP earns profits through partnership services with Open ERP consultants, and by providing support, training, hosting services, software development, and software quality testing and verification.
+
Install the {{aur|odoo}} package. Please note that the Odoo package comes with a bunch of python2 packages available in the [[AUR]]. These dependencies and the size of Odoo require much disk space to be used (1.8Gio only for the source and the final Odoo pkg without its dependencies). If you are building manually in the current directory, please make sure your current directory is on a device with enough free space. If you are using an [[AUR helper]], please [[Tmpfs#Examples|increase the size of your tmpfs]] or configure your AUR helper accordingly.
  
=Before Installing Open ERP=
+
=== Configuring PostgreSQL to run with Odoo ===
  
===Installing PostgreSQL===
+
Odoo uses PostgreSQL as the database backend. The latter should have been installed with the odoo package as {{pkg|postgresql}} comes as a dependency.
  
Open ERP uses the PostgreSQL database, which should be installed and configured before installing Open ERP. Follow [[PostgreSQL#Installing PostgreSQL]]. Complete these installation instructions, but do '''not''' perform any other configuration from that page. Return to this page for additional configuration steps.
+
It is necessary to create a new PostgreSQL user for Odoo. For that log in as the default PostgreSQL superuser, 'postgres', by executing the following command:
 +
*If you have {{Pkg|sudo}} and your username is in {{ic|sudoers}}:
 +
:{{bc|$ sudo -i -u postgres}}
 +
*Otherwise:
 +
:{{bc|<nowiki>
 +
$ su
 +
# su - postgres
 +
</nowiki>}}
  
===Configuring PostgreSQL for local use on your own machine===
+
If the PostgreSQL instance has not been initialized yet, please follow first the [[PostgreSQL#Installing PostgreSQL|PostgreSQL install process]].
  
If you plan to use PostgreSQL and Open ERP on the same machine, you will need to configure PostgreSQL to listen on the localhost's 5432 TCP port. Open {{ic|/var/lib/postgres/data/postgresql.conf}} and navigate to the {{ic|CONNECTIONS AND AUTHENTICATION}} section. Uncomment the {{ic|listen_addresses}} and {{ic|port}} lines. Save the file. When complete, the section should appear as follows:
+
Once logged as the 'postgres' user, create the database user (called ''role'' in the PostgreSQL ) ''odoo'' with the command that follows.
 +
* where ''--interactive'' is used to prompt for missing role name and attributes rather than using defaults
 +
* and  ''--pwprompt''' is used to assign a password to the new role
  
#------------------------------------------------------------------------------
+
You will first be asked for a password. For highly secure yet easy to remember passwords, consider using a [http://world.std.com/~reinhold/diceware.html Diceware Passphrase]. Re-enter the password as requested. The next three questions should be answered in sequence with n, y, and n.
# CONNECTIONS AND AUTHENTICATION
+
#------------------------------------------------------------------------------
+
+
# - Connection Settings -
+
+
listen_addresses = 'localhost'          # what IP address(es) to listen on;
+
                                        # comma-separated list of addresses;
+
                                        # defaults to 'localhost', '*' = all
+
                                        # (change requires restart)
+
port = 5432                            # (change requires restart)
+
  
Restart PostgreSQL so that it uses the newly changed conf file.
+
$ createuser odoo --interactive --pwprompt
 +
Enter password for new role:
 +
Enter it again:
 +
Shall the new role be a superuser? (y/n) n
 +
Shall the new role be allowed to create databases? (y/n) y
 +
Shall the new role be allowed to create more new roles? (y/n) n
  
Verify that PostgreSQL is listening on the localhost port 5432:
+
You can also use the following command line to specify the options to skip the interactive questions:
{{hc|# ss -anpt|
+
[postgres]$ createuser ''odoo'' --createdb --login --no-superuser --no-createrole --pwprompt
tcp        0      0 127.0.0.1:5432          0.0.0.0:*              LISTEN      13420/postgres}}
+
  
===Configuring PostgreSQL for remote use over a network===
+
Once you are finished answering these questions, type {{ic|exit}} to return to your regular user.
 
+
If you need remote access to PostgreSQL over a network, read [[PostgreSQL#Configure PostgreSQL to be accessible from remote hosts]].
+
 
+
===Setting up PostgreSQL to run with Open ERP===
+
 
+
Next, it is necessary to create a new PostgreSQL user for Open ERP. In this example, the user is 'yourusername', but you should replace this with your Arch system login username. First, log in as the default PostgreSQL superuser, 'postgres', by executing the following command from the CLI:
+
*If you have {{Pkg|sudo}} set up:
+
$ sudo -i -u postgres
+
*Otherwise:
+
$ su
+
# su - postgres
+
  
Once logged in as postgres, begin the process of creating the 'yourusername' user, with the folowing command:
+
This completes the required installation and setup of PostgreSQL for use with Odoo under Arch Linux. Additional detailed information about PostgreSQL configuration can be found in the [[PostgreSQL]] article. By default, PostgreSQL only accepts connections from the local machine. If you plan to run PostgreSQL and Odoo on two different machines, you will need to follow [[PostgreSQL#Configure PostgreSQL to be accessible from remote hosts]].
  
$ createuser yourusername -P
+
=== Configuring Odoo to run with PostgreSQL ===
  
You will first be asked for a password. For highly secure yet easy to remember passwords, consider using a [http://world.std.com/~reinhold/diceware.html Diceware Passphrase]. Re-enter the password as requested. The next three questions should be answered in sequence with n, y, and n. Shall the new role be a superuser? n Shall the new role be allowed to create database? y Shall the new role be allowed to create more new roles? n
+
The configuration file of Odoo is located at {{ic|/etc/odoo/odoo.conf}}. Specify the {{ic|db_user}} and {{ic|db_password}} according to the username and password you specified at previous step. If the PostgreSQL server is on a different machine, also edit {{ic|db_host}}.
  
You may also use options as below to skip the interactive questions to set the attributes:
+
[options]
 +
; This is the password that allows database operations:
 +
; admin_passwd = admin
 +
db_host = False
 +
db_port = False
 +
db_user = odoo
 +
db_password = False
 +
addons_path = /usr/lib/python2.7/site-packages/openerp/addons
  
$ createuser yourusername --createdb --login --no-superuser --no-createrole -P
+
=== Starting the server ===
  
Once you are finished answering these questions, type the word 'exit' to log out from PostgreSQL as the postgres superuser.
+
Ensure PostgreSQL is running and enabled first before running the following commands.
  
You may want to enable {{ic|postgresql}} with [[systemd]] so it will start at boot.
+
Use the command below to start odoo automatically at boot:
  
This completes the installation and setup of PostgreSQL for use with Open ERP under Arch Linux. Additional detailed information about PostgreSQL configuration may be found in the [[PostgreSQL]] article, and the [http://www.postgresql.org/docs/manuals/ PostgreSQL Manuals webpage]. Also, there is a powerful GUI PostgreSQL Admin tool, [http://www.pgadmin.org/ pgAdmin], which is available in the Arch repositories.
+
# systemctl enable odoo.service
  
=Installing Open ERP from AUR=
+
Use the command below to start odoo:
  
Open ERP requires the installation of the Open ERP Server, Open ERP comes with a webserver so you can use your web browser to use it. Currently, Open ERP is not available in the official repositories, but it is available through the Arch User Repository.
+
# systemctl start odoo.service
  
===install Open ERP===
+
=== Logging in ===
  
Install {{AUR|openerp}} from the [[AUR]].
+
Go to http://localhost:8069 in your web browser to access the Odoo login page.
  
===configure Open ERP===
+
== Running Odoo behind a reverse proxy ==
  
the configure file of Open ERP server is at {{ic|/etc/openerp/openerp-server.conf}}. make it look like this:
+
You can run odoo behind a web server such as [[Apache]] or [[Nginx]] in reverse proxy mode. This is useful for making odoo available in a local network, under a domaine name such as {{ic|odoo.mydomain.local}}. It is also useful to enable caching for static resources, and reduce the load on your odoo application.
+
  [options]
+
  ; This is the password that allows database operations:
+
  ; admin_passwd = admin
+
  db_host = localhost
+
  db_port = 5432
+
  db_user = yourusername  ##this is username you created in postegres.
+
  db_password =
+
if you want to run openerp in multiple process, you can add this line to  {{ic|/etc/openerp/openerp-server.conf}}.
+
workers = n # change n to a number you like.
+
  
=== start Open ERP server===
+
For this to work, you need to make sure that your local DNS-server (such as [[BIND]] or [[dnsmasq]]) resolves the domain name you choose to the web server's IP address. If running on your local machine, you could simply add an entry to {{ic|/etc/hosts}} like this:
  
use the command below to enable autostart openerp server when system boot:
+
127.0.0.1 odoo.mydomain.local
  
systemctl enable openerp-server.service
+
=== Using Nginx ===
  
use the command below to start openerp:
+
Refer to [[Nginx#Managing_server_entries|this guide]] for how to create virtual hosts in Nginx.
  
systemctl start openerp-server.service
+
Assuming your local domain is called {{ic|mydomain.local}}, and odoo is hosted on the same machine as your Nginx server, create a file inside the {{ic|servers-available}} directory that contains this server block:
  
=== login to Open ERP ===
+
{{hc|/etc/nginx/servers-available/odoo|<nowiki>
 +
upstream odoo {
 +
    server 127.0.0.1:8069;
 +
}
  
use your favorite web browser and go to link below:
+
server {
 +
    listen 80;
 +
    server_name odoo.mydomain.local;
 +
    root        /usr/share/nginx/html;
 +
    index      index.html index.htm;
 +
    access_log  /var/log/nginx/odoo-mydomain-local.access.log;
 +
    error_log  /var/log/nginx/odoo-mydomain-local.error.log;
  
  127.0.0.1:8069
+
    location / {
 +
        proxy_pass http://odoo;
 +
        # force timeouts if the backend dies
 +
        proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
 +
        proxy_redirect off;
  
shows openerp login page.
+
        # set headers
 +
        proxy_set_header    Host            $host;
 +
        proxy_set_header    X-Real-IP      $remote_addr;
 +
        proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
 +
        proxy_set_header    X-Forwarded-Proto https;
 +
    }
  
= additional settings =
+
    # cache some static data in memory for 60mins
you can see a complete list of configuration by using below command, it will save a copy of configuration file to {{ic|~/.openerp_serverrc}}.
+
    location ~* /web/static/ {
openerp-server -s
+
        proxy_cache_valid 200 60m;
for more information, use
+
        proxy_buffering on;
openerp-server --help
+
        expires 864000;
 +
        proxy_pass http://odoo;
 +
    }
 +
}
 +
</nowiki>}}
  
=Additional Open ERP Documentation=
+
To enable, simple create a symlink:
  
There are various sources of Open ERP documentation. The best place to start is the [http://doc.openerp.com/ Open ERP Documentation webpage]. This page links to different online documents, including [http://doc.openerp.com/install/index.html detailed installation instructions]. Additionally, there is an online copy of the book, [http://doc.openerp.com/book/index.html "Open ERP for Retail and Industrial Management"],and can be purchased from [http://www.amazon.com/Open-ERP-Retail-Industrial-Management/dp/2960087607/ Amazon.com]. While Open ERP documentation, such as "Open ERP for Retail and Industrial Management" is freely downloadable, it does not come with a free documentation license.
+
# ln -s /etc/nginx/servers-available/odoo /etc/nginx/servers-enabled/odoo
  
=Open ERP Community=
+
Reload or restart {{ic|nginx}} service to enable the new configuration.
  
The Open ERP Community is centered upon the [http://openobject.com/ Open Object website]. Free technical support for Open ERP may be found in the [http://openobject.com/forum/index.php webforums], a [http://tiny.be/mailman/listinfo/tinyerp-users mailing list]{{Linkrot|2011|09|06}} which is linked to the webforums, an [http://openobject.com/irc/ IRC channel] on freenode.net, an [http://www.openobject.com/wiki/index.php/Main_Page Open ERP wiki], and the [http://doc.openerp.com/ Official ERP Documentation webpage.] The latest news may be found on [http://openerp.com/planet/ Open ERP Planet], while various Open ERP screencasts are provided on [http://www.openerp.tv/ Open ERP TV]. Fee-based support services are provided by [http://openerp.com/en/partners.html Open ERP Partners]{{Linkrot|2011|09|06}}.
+
# systemctl restart nginx.service
  
=Open Object RAD=
+
== Additional documentation==
  
Open Object is the Python-based [http://openobject.com/index.php?option=com_content&view=article&id=46&Itemid=53 Rapid Application Development framework] for developing Open ERP modules. It allows developers and businesses to customize Open ERP for specific needs. Open Object RAD development work is centered upon the [https://launchpad.net/openobject Open Object Launchpad page]. Developer news and blogs are published on [http://openobject.com/planet/ Open Object Planet]. There are pages for [http://www.openerp.com/index.php?option=com_content&view=article&id=18&Itemid=28 software downloads], [http://doc.openerp.com/modindex.html Open ERP module downloads]{{Linkrot|2011|09|06}}, and [http://openobject.com/index.php?option=com_content&view=article&id=53&Itemid=61 development source code downloads].
+
As Odoo is a complete enterprise solution, it might be rather complex to use for newcomers. Therefore, reading the [https://www.odoo.com/documentation/user/9.0/ Odoo User Documentation] and [https://www.odoo.com/documentation/9.0/ Odoo technical documentation] is highly advised.

Latest revision as of 15:35, 1 September 2016

Odoo (formerly known as OpenERP and before that, TinyERP) is a suite of open-source enterprise management applications. Targeting companies of all sizes, the application suite includes billing, accounting, manufacturing, purchasing, warehouse management, and project management.

Odoo features an application server which uses PostgreSQL as database back-end, with a web-based client. Odoo is written in Python, with a highly modular design which allows rapid development of new modules through Open Object RAD. Odoo developers have a strong commitment to free software.

A thriving support and development community has grown up around Odoo, providing free technical support, bug-fixing, new development, and support services. Odoo provides extensive documentation in various electronic formats, as well as hardcopy. The company responsible for development of Odoo earns profits through partnership services with Odoo consultants, and by providing support, training, hosting services, software development, and software quality testing and verification.

Installation

Installing Odoo

Install the odooAUR package. Please note that the Odoo package comes with a bunch of python2 packages available in the AUR. These dependencies and the size of Odoo require much disk space to be used (1.8Gio only for the source and the final Odoo pkg without its dependencies). If you are building manually in the current directory, please make sure your current directory is on a device with enough free space. If you are using an AUR helper, please increase the size of your tmpfs or configure your AUR helper accordingly.

Configuring PostgreSQL to run with Odoo

Odoo uses PostgreSQL as the database backend. The latter should have been installed with the odoo package as postgresql comes as a dependency.

It is necessary to create a new PostgreSQL user for Odoo. For that log in as the default PostgreSQL superuser, 'postgres', by executing the following command:

  • If you have sudo and your username is in sudoers:
$ sudo -i -u postgres
  • Otherwise:
$ su
# su - postgres

If the PostgreSQL instance has not been initialized yet, please follow first the PostgreSQL install process.

Once logged as the 'postgres' user, create the database user (called role in the PostgreSQL ) odoo with the command that follows.

  • where --interactive is used to prompt for missing role name and attributes rather than using defaults
  • and --pwprompt' is used to assign a password to the new role

You will first be asked for a password. For highly secure yet easy to remember passwords, consider using a Diceware Passphrase. Re-enter the password as requested. The next three questions should be answered in sequence with n, y, and n.

$ createuser odoo --interactive --pwprompt
Enter password for new role: 
Enter it again: 
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create databases? (y/n) y
Shall the new role be allowed to create more new roles? (y/n) n

You can also use the following command line to specify the options to skip the interactive questions:

[postgres]$ createuser odoo --createdb --login --no-superuser --no-createrole --pwprompt

Once you are finished answering these questions, type exit to return to your regular user.

This completes the required installation and setup of PostgreSQL for use with Odoo under Arch Linux. Additional detailed information about PostgreSQL configuration can be found in the PostgreSQL article. By default, PostgreSQL only accepts connections from the local machine. If you plan to run PostgreSQL and Odoo on two different machines, you will need to follow PostgreSQL#Configure PostgreSQL to be accessible from remote hosts.

Configuring Odoo to run with PostgreSQL

The configuration file of Odoo is located at /etc/odoo/odoo.conf. Specify the db_user and db_password according to the username and password you specified at previous step. If the PostgreSQL server is on a different machine, also edit db_host.

[options]
; This is the password that allows database operations:
; admin_passwd = admin
db_host = False
db_port = False
db_user = odoo
db_password = False
addons_path = /usr/lib/python2.7/site-packages/openerp/addons

Starting the server

Ensure PostgreSQL is running and enabled first before running the following commands.

Use the command below to start odoo automatically at boot:

# systemctl enable odoo.service

Use the command below to start odoo:

# systemctl start odoo.service

Logging in

Go to http://localhost:8069 in your web browser to access the Odoo login page.

Running Odoo behind a reverse proxy

You can run odoo behind a web server such as Apache or Nginx in reverse proxy mode. This is useful for making odoo available in a local network, under a domaine name such as odoo.mydomain.local. It is also useful to enable caching for static resources, and reduce the load on your odoo application.

For this to work, you need to make sure that your local DNS-server (such as BIND or dnsmasq) resolves the domain name you choose to the web server's IP address. If running on your local machine, you could simply add an entry to /etc/hosts like this:

127.0.0.1 odoo.mydomain.local

Using Nginx

Refer to this guide for how to create virtual hosts in Nginx.

Assuming your local domain is called mydomain.local, and odoo is hosted on the same machine as your Nginx server, create a file inside the servers-available directory that contains this server block:

/etc/nginx/servers-available/odoo
upstream odoo {
    server 127.0.0.1:8069;
}

server {
    listen 80;
    server_name odoo.mydomain.local;
    root        /usr/share/nginx/html;
    index       index.html index.htm;
    access_log  /var/log/nginx/odoo-mydomain-local.access.log;
    error_log   /var/log/nginx/odoo-mydomain-local.error.log;

    location / {
        proxy_pass  http://odoo;
        # force timeouts if the backend dies
        proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
        proxy_redirect off;

        # set headers
        proxy_set_header    Host            $host;
        proxy_set_header    X-Real-IP       $remote_addr;
        proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header    X-Forwarded-Proto https;
    }

    # cache some static data in memory for 60mins
    location ~* /web/static/ {
        proxy_cache_valid 200 60m;
        proxy_buffering on;
        expires 864000;
        proxy_pass http://odoo;
    }
}

To enable, simple create a symlink:

# ln -s /etc/nginx/servers-available/odoo /etc/nginx/servers-enabled/odoo

Reload or restart nginx service to enable the new configuration.

# systemctl restart nginx.service

Additional documentation

As Odoo is a complete enterprise solution, it might be rather complex to use for newcomers. Therefore, reading the Odoo User Documentation and Odoo technical documentation is highly advised.