logo

Installing Zoook on Ubuntu – Part IV: Zoook – Parametrize and connect with OpenERP

 

 

Installing Zoook on Ubuntu

 

Artículo también disponible en castellano.

The final part of the series of articles dedicated to Zoook. After finalising the installation of Zoook we’re going over to its parametrisation and the connection with the OpenERP server.

1. Install OpenERP dependencies

You’ll have to install the following modules in OpenERP:

2. Connecting Zoook to the Database

At first create a PostgreSQL database for Zoook. In a development environment you can use the user openerp. This way you don’t have to create a new one. In production its recommended to make sure that every user has an exclusive access to the database.

$ sudo -u postgres psql
postgres=# CREATE DATABASE dj_zoook OWNER openerp;
postgres=# l

The last command shows the existent databases. If everything worked out fine it should show someting like the following:

 

 

Installing Zoook on Ubuntu

 

Verify the correct creation of the database.

3. Parametrisation of Zoook

 

3.1.~/django-projects/zoook-app/config.py

Edit the file and adjust the parameters of the connection to OpenERP. You’ll have to configure all passages. The following ones are especially important for the interconnection with the OpenERP server and error detection:

  • LANGUAGES

    Defines the languages of your web shop. They have to be the same as in OpenERP.

    #Edit your languagesLANGUAGE_CODE = 'es'LANGUAGES = (
        ('es', ugettext('Spanish')),
        ('en', ugettext('English')),
    )
    DEFAULT_LANGUAGE = 1
    LOCALE_URI = True
  • OERP_SALE

    Indicates which OpenERP shop should be used in Zoook (just for the case that you have several shops).

    OERP_SALE = 1 #Sale Shop. All price, orders, ... use this Sale Shop ID.
  • LOGS

    Defines the path to Zoooks logging files.

    LOGFILE = '/home/roberto/django-projects/zoook-app/log/sync.log'#path sync logLOGSALE = '/home/roberto/django-projects/zoook-app/log/sale.log'#path sale log
  • DATABASES

    Defines where and how Zoook finds its database.

    DATABASES = {
        'default': {
            'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.'NAME': 'dj_zoook',     # Or path to database file if using sqlite3.'USER': 'openerp',      # Not used with sqlite3.'PASSWORD': 'openerp',  # Not used with sqlite3.'HOST': 'localhost',    # Set to empty string for localhost. Not used with sqlite3.'PORT': '5432',         # Set to empty string for default. Not used with sqlite3.
        }
    }
    
  • OERP_CONF

    Defines the connection to the XML-RPC service of OpenERP.

    OERP_CONF = {
        'username':'admin',
        'password':'openerp',
        'dbname':'openerp',
        'protocol':'xmlrpc', #xmlrpc'uri':'http://localhost', #xmlrpc'port':8069, #xmlrpc# 'protocol':'pyro', #pyro# 'uri':'localhost', #pyro# 'port':8071, #pyro
    }
    

3.2.~/django-projects/zoook-app/sync/config_path.py

Contains the routes to Zoook so that the SSH synchronisation process can find the needed files.

djpath = '/home/roberto/django-projects/zoook-app'

3.3.~/django-projects/zoook-app/settings.py

Edit this file to assign a new unique password to Zoook. I’d recommend to use a password generator such as safepasswd.com.

# Make this unique, and don't share it with anybody.SECRET_KEY = 'YOUR_PASSWORD_GOES_HERE'

3.4. Create Zoooks database tables

  • Generate the data base structure
    $ cd ~/django-projects/zoook-app
    $ python manage.py syncdb
    

    The script will ask if you want to create a new super-user. Affirm and pass it the needed data for the account you’ll later want to administer Zoook with.

     

     

    Installing Zoook on Ubuntu

     

    Create a superuser for Django.

3.5. ~/django-projects/zoook-app/configuration.py

Execute the configuration assistant and give it further information needed by Django.

  • Execute configuration.py
    $ cd ~/django-projects/zoook-app
    $ ./configuration.py
    

    The output should look like this:

     

     

    Installing Zoook on Ubuntu

     

    Configuration of Django.

3.6. Adjust file permissions

  • Change the permissions in the sync directory
    $ cd ~/django-projects/zoook-app/
    $ sudo chown -R roberto:www-data *
    $ sudo chmod 775 -R sync
    

3.7. Testing Zoook

  • Run the server
    $ cd ~/django-projects/zoook-app/
    $ python manage.py runserver
    

    this should show something like:

     

     

     

    Successfully initiated Django server.

    Open your browser and open up the direction of the server (http://127.0.0.1:8000/). Zoook should load the first time and you should end up with a site like this:

     

     

    Installing Zoook on Ubuntu

     

    Start page of Zoook.

    Access the administration area with the super user credentials created beforehand:

     

     

     

    Zooks administration page.

4. Connecting Zoook with OpenERP

A SSH server is required on the machine where Zoook is installed:

$ sudo apt-get install openssh-server

The next step is to configure poweremail to create a template for orders. This article won’t cover the further details of this step. You can get that information here.

Now, open up OpenERP and configure the shop for the connection with Zoook. Open

Sales => Configuration => Sales => Shop

Choose the shop you’re going to use with Zoook, edit it and check the box next to OpenERP e-Sale in the upper right. As an outcome of this should appear a new configuration tab for Zoook.

 

 

 

Indicate a shop fort exportation.

 

 

 

Mark all products for exportation.

 

 

 

Configure the SSH connection.

When doing the test of the connection it should pop up a message, saying that it is configured properly.

5. Export test products

Now, we’ll only have to add some test categories and products. The only thing noteworthy at this point is that in order to export a product to the web you have to check “Export to online shop?”. Once this is checked you’ll see a new tab with the name “e-Sale” where you can parametrise the options of the product of the web shop.

 

 

Installing Zoook on Ubuntu

 

Arrange e-Sale options on a product.

After the creation of products you’ll have to go back to the configuration of the shop to export products, categories, images etc. After doing a refresh of the page of Zoook you should be able to see the introduced data:

 

 

Installing Zoook on Ubuntu

 

With excellent results exported category in Zoook.

 

 

Installing Zoook on Ubuntu

 

Successfully exported product in Zoook.

Read more http://www.domatix.com/installing-zoook-on-ubuntu-%E2%80%93-part-iv-zoook-%E2%80%93-parametrize-and-connect-with-openerp

You could find more information about the article in our web: https://openerpspain.com/odoo/