Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Odoo 10 Development Essentials

You're reading from   Odoo 10 Development Essentials Explore the functionalities of Odoo to build powerful business applications.

Arrow left icon
Product type Paperback
Published in Nov 2016
Publisher Packt
ISBN-13 9781785884887
Length 298 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Daniel Reis Daniel Reis
Author Profile Icon Daniel Reis
Daniel Reis
Arrow right icon
View More author details
Toc

Table of Contents (14) Chapters Close

Preface 1. Getting Started with Odoo Development FREE CHAPTER 2. Building Your First Odoo Application 3. Inheritance – Extending Existing Applications 4. Module Data 5. Models – Structuring the Application Data 6. Views - Designing the User Interface 7. ORM Application Logic – Supporting Business Processes 8. Writing Tests and Debugging Your Code 9. QWeb and Kanban Views 10. Creating QWeb Reports 11. Creating Website Frontend Features 12. External API – Integrating with Other Systems 13. Deployment Checklist – Going Live

Developing from your workstation

You may be running Odoo with a Debian/Ubuntu system either in a local virtual machine or in a server over the network. But you may prefer to do the development work at your personal workstation, using your favorite text editor or IDE. This may frequently be the case for developers working from Windows workstations. But it also may be the case for Linux users who need to work on an Odoo server over the local network.

A solution for this is to enable file sharing in the Odoo host so that files are made easy for editing from our workstation. For Odoo server operations, such as a server restart, we can use an SSH shell (such as PuTTY on Windows) alongside our favorite editor.

Using a Linux text editor

Sooner or later, we will need to edit files from the shell command line. In many Debian systems, the default text editor is vi. If you're not comfortable with it, you probably could use a friendlier alternative. In Ubuntu systems, the default text editor is nano. You might prefer it since it's easier to use. In case it's not available in your server, it can be installed with:

$ sudo apt-get install nano

In the following sections, we will assume nano as the preferred editor. If you prefer any other editor, feel free to adapt the commands accordingly.

Installing and configuring Samba

The Samba service helps make Linux file-sharing services compatible with Microsoft Windows systems. We can install it on our Debian/Ubuntu server with this command:

$ sudo apt-get install samba samba-common-bin

The samba package installs the file-sharing services, and the samba-common-bin package is needed for the smbpasswd tool. By default, users allowed to access shared files need to be registered with it. We need to register our user, odoo for example, and set a password for its file share access:

$ sudo smbpasswd -a odoo

After this, we will be asked for a password to use to access the shared directory, and the odoo user will be able to access shared files for its home directory, although it will be read only. We want to have write access, so we need to edit the Samba configuration file to change it as follows:

$ sudo nano /etc/samba/smb.conf

In the configuration file, look for the [homes] section. Edit its configuration lines so that they match the settings as follows:

[homes] 
    comment = Home Directories 
    browseable = yes 
    read only = no 
    create mask = 0640 
    directory mask = 0750 

For the configuration changes to take effect, restart the service:

$ sudo /etc/init.d/smbd restart

Tip

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com . If you purchased this book from elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

To access the files from Windows, we can map a network drive for the path \\<my-server-name>\odoo using the specific username and password defined with smbpasswd. When trying to log in with the odoo user, you might encounter trouble with Windows adding the computer's domain to the username (for example, MYPC\odoo). To avoid this, use an empty domain by prepending a \ character to the login (for example, \odoo):

Installing and configuring Samba

If we now open the mapped drive with Windows Explorer, we will be able to access and edit the contents of the odoo user's home directory:

Installing and configuring Samba

Odoo includes a couple of tools that are very helpful for developers, and we will make use of them throughout the book. They are technical features and the developer mode. These are disabled by default, so this is a good moment to learn how to enable them.

Activating the developer tools

The developer tools provide advanced server configuration and features. These include a debug menu in the top menu bar along with additional menu options in the Settings menu, in particular the Technical menu.

These tools come disabled by default, and to enable them, we need to log in as admin. In the top menu bar, select the Settings menu. At the bottom-right, below the Odoo version, you will find two options to enable the developer mode; any of them will enable the Debug and Technical menus. The second option, Activate the developer mode (with assets), also disables the minification of JavaScript and CSS used by the web client, making it easier to debug client-side behavior:

Activating the developer tools

After that, the page is reloaded and you should see a bug icon in the top menu bar, just before the session user avatar and name providing the debug mode options. And in the Settings option in the top menu, we should see a new Technical menu section giving access to many Odoo instance internals:

Activating the developer tools

Tip

The Technical menu option allows us to inspect and edit all the Odoo configurations stored in the database, from user interface to security and other system parameters. You will be learning more about many of these throughout the book.

You have been reading a chapter from
Odoo 10 Development Essentials
Published in: Nov 2016
Publisher: Packt
ISBN-13: 9781785884887
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime