Odoo Help

1

How To Upgrade Nightly Build

By
Wira Bakti Soenaryo
on 2/27/13, 2:46 AM 5,413 views

Hello,

As of the subject, how to correctly upgrade our openerp server? Until now usually I do like this 1. download the newest version 2. stop the openerp server => /etc/init.d/openerp stop 3. remove the openerp => apt-get remove openerp 4. install the new version => gdebi opernerp.... Currently I'm using Ubuntu 12.04. Is that the best way to upgrade or maybe any other suggestion? Thanks...

3
OnuR
On 2/27/13, 12:10 PM

you can use bzr as follows:

TO INSTALL:

sudo apt-get install bzr

sudo su – openerp

cd /opt/openerp

bzr branch lp:openobject-server/7.0 server

bzr branch lp:openobject-addons/7.0 addons

bzr branch lp:openerp-web/7.0 web

TO UPDATE

sudo /etc/init.d/openerp-server stop

sudo su - openerp -s /bin/bash

cd /opt/openerp/addons/

bzr pull

cd /opt/openerp/web/

bzr pull

cd /opt/openerp/server/

bzr pull

Check this for full installation:

Check question 2562 how-to-install-openerp-v70-on-ubuntu-1204-from-launchpad-repository

I can't post link due to Karma limitation.

2

Ray Carnes

--Ray Carnes--
17148
| 9 7 9
Atlanta, United States
--Ray Carnes--

Senior Odoo Analyst

OpenERP 6.1, 7.0; Odoo 8.0, 9.0, 10.0.

Completed Odoo Functional and Technical Training.

Major Skills:

  • User Needs and GAP Analysis;

  • Functional and Technical Design;

  • Prototyping and Proof of Concepts;

  • Requirements Specifications;

  • Agile Implementation;

  • Data Migration;

  • Configuration & Customization (UI and code);

  • Integration - Odoo and non Odoo Applications and Services;

  • Training and Knowledge Transfer;

  • Go Live Support;

  • Helpdesk;

  • Version Upgrades and Migration.

  • Accounting Expert.

I have over 20 years of experience empowering and enabling users with enterprise information systems that make a real and measurable difference in their ability to proactively manage their businesses and organizations. 

I am a skilled Communicator and I only take the serious things seriously!

Ray Carnes
On 2/27/13, 12:24 PM

Upgrading has two steps:

  1. The source code
  2. The database(s)

This is a script one of our clients, Logic Supply, uses to upgrade the code and the databases:

#!/usr/bin/env python
# update-branches
# Author:       Brendan Clune
# Description:  Updates the server, web, and addons branches of
#               OpenERP and records their previous revision numbers
#               in a timestamped update log.

from datetime import date
import subprocess, xmlrpclib, sys, os, psycopg2, pexpect

# Database info
db_user = '<your credentials>'
db_passwd = '<your credentials>'
db_host = '<your server>'
db_port = 5432
db_name = 'postgres'
oerp_conf = '<path to your configuration file>'
oerp_bin = "<path to openerp-server branch folder>/openerp-server"

today = date.today()
log_date = today.strftime('%Y%m%d')
log_name = "branch-update-{}.log".format(log_date)
base_dir = os.getcwd()

with open(log_name, 'a+') as log_file:
  for branch in ["server", "web", "addons"]:
    # Get revision number
    rev_cmd = ["bzr", "revno", branch]
    try:
      rev_no = subprocess.check_output(rev_cmd, stderr=subprocess.STDOUT).strip()
    except subprocess.CalledProcessError as e:
      print "Error invoking bzr revno: {}".format(e.strerror)
    status = "Pulling latest {} revision (currently {}).".format(branch, rev_no)
    print status
    log_file.write(status + "\n")

    # Update branch
    update_cmd = ["bzr", "pull"]
    try:
      os.chdir(branch)
      status = subprocess.check_output(update_cmd, stderr=subprocess.STDOUT).strip()
    except subprocess.CalledProcessError as e:
      print "Error invoking bzr update: {}".format(e.strerror)
    os.chdir(base_dir)
    print status
    log_file.write(status + "\n")

  # Get list of databases
  db = psycopg2.connect(user=       db_user, 
                        password=   db_passwd,
                        host=       db_host,
                        port=       db_port,
                        database=   db_name)
  cr = db.cursor()
  cr.execute("select datname from pg_database where datdba=(select usesysid from pg_user where usename='{}') order by datname".format(db_user))
  dblist = [str(name) for (name,) in cr.fetchall()]

  for database in dblist:
    # Wait for server to upgrade database, then kill it
    print "Upgrading database {}...".format(database)
    dbupdate_cmd = "{} -c {} --database={} --update=all".format(oerp_bin, oerp_conf, database) 
    output = pexpect.spawn(dbupdate_cmd)
    try:
      output.expect('.*OpenERP server is running, waiting for connections...', timeout=600)
    except pexpect.ExceptionPexpect as e:
      print "Timeout reached while upgrading {}. Try manually upgrading the database with the command '{}'.".format(database, dbupdate_cmd)
    output.kill(0)

    status = "Upgraded database {}.".format(database)
    print status
    log_file.write(status + "\n")

Thanks for the code... anyway, may I know what kind of file extention it will be and how do I run it?

Wira Bakti Soenaryo
on 2/27/13, 11:38 PM

It is a Python script.

Bista Solutions US, Ray Carnes
on 2/28/13, 12:18 AM

Wooooowww! To Pyromaniac like me! this is a box of matches and a window into another world...burn baby burn! :)))))

Cameron
on 2/28/13, 7:06 AM

Just a heads up; you'll want to install the Python module 'pexpect' to make everything work. 'sudo easy-install pexpect' should do the trick! You'll want to leave it at the root of your OpenERP folder and run it from there, or adjust the paths accordingly.

Brendan Clune
on 2/28/13, 5:52 PM

Hai... if for example I backup my current database... then remove the current openerp and install the lastest one.. After that I restore the database. As of the information above, the database upgrade will or will not be perform? IF NOT... then the backup database feature is just useless then? Thanks...

Wira Bakti Soenaryo
on 3/2/13, 2:16 AM

Yes. Backup works for keeping a copy of your database in case you need to restore it on the same version (the usual benefit of a backup) as well as for migrating/upgrading between minor versions of OpenERP (ie: from 6.1 March to 6.1 November or from 7.0 December to 7.0 March) when you use the --update=all command-line argument. You cannot migrate between major versions (ie: from 6.1 to 7.0) using this method.

Bista Solutions US, Ray Carnes
on 3/4/13, 2:38 PM
0
Peter Seng
On 2/27/13, 4:43 AM

you can use bzr tool to pull from lauchpad...when you upgrade just use "bzr pull"

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

2 follower(s)

Stats

Asked: 2/27/13, 2:46 AM
Seen: 5413 times
Last updated: 1/6/17, 11:10 PM