Difference between revisions of "Odoo"

From ArchWiki
Jump to: navigation, search
m (Configuring PostgreSQL for local use on your own machine: Change to iproute2 ss command.)
m (add ja link)
 
(80 intermediate revisions by 14 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 wikipage 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, along with a standalone GTK-based client, as well as 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 ===
  
The following instructions assume that you have installed the 'sudo' command on your Arch Linux system. If you have not already done so, go to the [[sudo]] Arch Wikipage for more information.
+
Odoo uses PostgreSQL as the database backend. The latter should have been installed with the odoo package as {{pkg|postgresql}} comes as a dependency.
  
===Installing PostgreSQL===
+
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>}}
  
Open ERP uses the PostgreSQL database, which should be installed and configured before installing Open ERP. Follow the instructions in the "Installing PostgreSQL" section of the [https://wiki.archlinux.org/index.php/PostgreSQL#Installing_PostgreSQL Arch PostgreSQL Wikipage]. Complete these installation instructions, but do '''not''' perform any other configuration from that page. Return to this page for additional configuration steps.
+
If the PostgreSQL instance has not been initialized yet, please follow first the [[PostgreSQL#Installing PostgreSQL|PostgreSQL install process]].
  
===Configuring PostgreSQL for local use on your own machine===
+
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
  
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. As root, open the following configuration file with a text editor:
+
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.
  
  /var/lib/postgres/data/postgresql.conf
+
  $ 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
  
Search for the following section within the postgresql.conf file:
+
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 {{ic|exit}} to return to your regular user.
# 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)
+
+
Uncomment the #listen_addresses line, and replace the text 'localhost' with '127.0.0.1'. Also, uncomment the #port line. Save the file. When complete, the file should appear as follows:
+
  
#------------------------------------------------------------------------------
+
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]].
# CONNECTIONS AND AUTHENTICATION
+
#------------------------------------------------------------------------------
+
+
# - Connection Settings -
+
+
listen_addresses = '127.0.0.1'          # 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, by executing the following command:
+
=== Configuring Odoo to run with PostgreSQL ===
  
sudo /etc/rc.d/postgresql restart
+
The configuration file of Odoo is located at {{ic|/etc/odo/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}}.
  
Verify that PostgreSQL is listening on the localhost port 5432 by executing the following command:
+
[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 ===
  
# ss -anpt
+
Ensure PostgreSQL is running and enabled first before running the following commands.
  
Within the output from this command, you should find the following line of text, except for the PID number which will very likely be different:
+
Use the command below to start odoo automatically at boot:
  
  tcp        0      0 127.0.0.1:5432          0.0.0.0:*              LISTEN      13420/postgres
+
  # systemctl enable odoo.service
  
===Configuring PostgreSQL for remote use over a network===
+
Use the command below to start odoo:
  
If you need remote access to PostgreSQL over a network, read the following section from the [https://wiki.archlinux.org/index.php/PostgreSQL#Configure_PostgreSQL_to_be_accessible_from_remote PostgreSQL Arch Wikipage].
+
# systemctl start odoo.service
  
===Setting up PostgreSQL to run with Open ERP===
+
=== Logging in ===
  
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:
+
Go to http://localhost:8069 in your web browser to access the Odoo login page.
  
sudo su - postgres
+
== Running Odoo behind a reverse proxy ==
  
Once logged in as postgres, begin the process of creating the 'yourusername' user, with the folowing command:
+
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.
  
createuser yourusername -P
+
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:
  
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
+
127.0.0.1 odoo.mydomain.local
  
Once you are finished answering these questions, type the word 'exit' to log out from PostgreSQL as the postgres superuser.
+
=== Using Nginx ===
  
You may want to edit your /etc/rc.conf file by adding postgresql to the Daemons list, so that PostgreSQL will automatically start up when you boot up your computer.
+
Refer to [[Nginx#Managing_server_entries|this guide]] for how to create virtual hosts in Nginx.
  
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 on the Arch Wikipage for [[PostgreSQL]], 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.
+
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:
  
=Installing Open ERP from AUR=
+
{{hc|/etc/nginx/servers-available/odoo|<nowiki>
 +
upstream odoo {
 +
    server 127.0.0.1:8069;
 +
}
  
Open ERP requires the installation of the Open ERP Server, and either the Open ERP GTK-Client or the Open ERP Web-Client. Currently, Open ERP is not available in the main repositories of Arch Linux, but it is available through the Arch User Repository. Open ERP requires Python 2.5, various libraries compiled with Python 2.5, and a few other dependencies not found in the Arch repositories. All of these packages are provided through AUR. The best tool for downloading, compiling, and installing AUR packages is [[yaourt]]. The following instructions assume that yaourt has been installed and configured on the user's system.
+
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;
  
===Open ERP GTK-Client===
+
    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;
  
To install the Open ERP standalone GTK-based client, from the CLI, execute the following command:
+
        # 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;
 +
    }
  
yaourt -S openerp-client
+
    # 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;
 +
    }
 +
}
 +
</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"]. This copy is also available as a [http://www.openerp.com/en/buy/e-book.html PDF file]{{Linkrot|2011|09|06}}, and can be purchased in [http://www.openerp.com/buy.html?page=shop.product_details&flypage=openerp.tpl&product_id=36&category_id=8 hardcopy form from Open ERP]{{Linkrot|2011|09|06}} or 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. Further details about this issue are found on the [http://doc.openerp.com/documentation_license.html Open ERP website]{{Linkrot|2011|09|06}}. Finally, [http://www.openerp.tv/ Open ERP TV] provides screencasts, some of which document various features and procedures of the software.
+
# 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, 16 March 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/odo/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.