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 in 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 that 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 easy to edit 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, then 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 project provides Linux file sharing services compatible with Microsoft Windows systems. We can install it on our Debian/Ubuntu server with:
$ 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
and set a password for its file share access:
$ sudo smbpasswd -a odoo
After this the odoo
user will be able to access a fileshare for its home directory, but it will be read only. We want to have write access, so we need to edit Sambas, configuration file to change that:
$ 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 below:
[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 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 user and password defined with smbpasswd
. When trying to log in with the odoo
user, you might find trouble with Windows adding the computer's domain to the user name (for example MYPC\odoo
). To avoid this, use an empty domain by prepending a \
to the login (for example \odoo
).
If we now open the mapped drive with Windows Explorer, we will be able to access and edit the contents of the odoo
user home directory.