Book Image

Odoo 10 Development Essentials

By : Daniel Reis
Book Image

Odoo 10 Development Essentials

By: Daniel Reis

Overview of this book

Odoo is one of the fastest growing open source, business application development software products available. With announcement of Odoo 10, there are many new features added to Odoo and the face of business applications developed with Odoo has changed. This book will not only teach you how to build and customize business applications with Odoo, but it also covers all the new features that Odoo has to offer. This book is the latest resource on developing and customizing Odoo 10 applications. It comes packed with much more and refined content than its predecessor. It will start with building business applications from scratch and will cover topics such as module extensions, inheritance, working with data, user interfaces, and so on. The book also covers the latest features of Odoo 10, in addition to front end development, testing and debugging techniques. The book will also talk about Odoo Community and Odoo Enterprise.
Table of Contents (20 chapters)
Odoo 10 Development Essentials
Credits
Foreword
About the Author
About the Reviewer
www.PacktPub.com
Preface

Setting up a host for the Odoo server


A Debian/Ubuntu system is recommended for the Odoo server. You will still be able to work from your favorite desktop system, be it Windows, Mac, or Linux.

Odoo can run on a variety of operating systems, so why pick Debian at the expense of other operating systems? Because Debian is considered the reference deployment platform by the Odoo team; it has the best support. It will be easier to find help and additional resources if we work with Debian/Ubuntu.

It's also the platform that the majority of developers work on and where most deployments are rolled out. So, inevitably, Odoo developers are expected to be comfortable with the Debian/Ubuntu platform. Even if you're from a Windows background, it will be important that you have some knowledge about it.

In this chapter, you will learn how to set up and work with Odoo hosted on a Debian-based system, using only the command line. For those at home with a Windows system, we will cover how to set up a virtual machine to host the Odoo server. As a bonus, the techniques you will learn here will also allow you to manage Odoo in cloud servers, where your only access will be through Secure Shell (SSH).

Note

Keep in mind that these instructions are intended to set up a new system for development. If you want to try some of them in an existing system, always take a backup ahead of time in order to be able to restore it in case something goes wrong.

Provision for a Debian host

As explained earlier, we will need a Debian-based host for our Odoo server. If these are your first steps with Linux, you may like to note that Ubuntu is a Debian-based Linux distribution, so they are very similar.

Odoo is guaranteed to work with the current stable version of Debian or Ubuntu. At the time of writing, these are Debian 8 "Jessie" and Ubuntu 16.04.1 LTS (Xenial Xerus). Both ship with Python 2.7, which is necessary to run Odoo. It is worth saying that Odoo does not support Python 3 yet, so Python 2 is required.

If you are already running Ubuntu or another Debian-based distribution, you're set; this can also be used as a host for Odoo.

For the Windows and Mac operating systems, install Python, PostgreSQL, and all the dependencies; next, run Odoo from the source natively. However, this could prove to be a challenge, so our advice is to use a virtual machine running Debian or Ubuntu Server. You're welcome to choose your preferred virtualization software to get a working Debian system in a virtual machine.

In case you need some guidance, here is some advice regarding the virtualization software. There are several options, such as Microsoft Hyper-V (available in some versions of recent Windows systems), Oracle VirtualBox, and VMWare Workstation Player (VMWare Fusion for Mac). The VMWare Workstation Player is probably easier to use, and free-to-use downloads can be found at https://my.vmware.com/web/vmware/downloads .

Regarding the Linux image to use, it will be more user-friendly to install Ubuntu Server than Debian. If you're beginning with Linux, I would recommend that you try a ready-to-use image. TurnKey Linux provides easy-to-use preinstalled images in several formats, including ISO. The ISO format will work with any virtualization software you choose, even on a bare-metal machine you might have. A good option might be the LAPP image, which includes Python and PostgreSQL, and can be found at http://www.turnkeylinux.org/lapp .

Once installed and booted, you should be able to log in to a command-line shell.

Creating a user account for Odoo

If you are logging in using the superuser root account, your first task should be to create a normal user account to use for your work, since it's considered bad practice to work as root. In particular, the Odoo server will refuse to run if you start it as the root.

If you are using Ubuntu, you probably won't need this since the installation process must have already guided you through the creation of a user.

First, make sure sudo is installed. Our work user will need it. If logged in as the root, execute the following commands:

# apt-get update && apt-get upgrade  # Install system updates
# apt-get install sudo  # Make sure 'sudo' is installed

The next set of commands will create an odoo user:

# useradd -m -g sudo -s /bin/bash odoo  # Create an 'odoo' user with sudo powers
# passwd odoo  # Ask and set a password for the new user

You can change odoo to whatever username you may want. The -m option ensures its home directory is created. The -g sudo option adds it to the sudoers list so it can run commands as the root. The -s /bin/bash option sets the default shell to bash, which is nicer to use than the default sh.

Now we can log in as the new user and set up Odoo.