Odoo Help


TypeError when duplicating a database with Custom Module installed (OpenERP v7)

Paul Strinati
on 10/14/14, 9:29 AM 1,131 views

I've created a very simple custom module to add a boolean field to the hr_expense_line as follows:


import ocl_hr_expense



    'name': "OCL HR Expense Additions",
    'version': "1.0",
    'author': "Paul Strinati",
    'category': "Tools",
    'depends': ['hr'],
    'data': ['ocl_hr_expense.xml'],
    'demo': [],
    'installable': True,


from openerp.osv import fields, osv
class ocl_hr_expense(osv.osv):
    _inherit = "hr.expense.line"
    _columns = {
        'abc': fields.boolean('ABC Reportable')
    _defaults ={
        'abc': 0


<?xml version="1.0" encoding="utf-8"?>
    <record model="ir.ui.view" id="ocl_hr_expense">
      <field name="name">hr.expense.line.tree</field>
      <field name="model">hr.expense.expense</field>
      <field name="inherit_id" ref="hr_expense.view_expenses_form" />
      <field name="arch" type="xml">
        <xpath expr="/form/sheet/notebook/page[@string='Description']/field[@name='line_ids']/tree[@string='Expense Lines']/field[@name='name']" position="after">
          <field name="abc" />

So far...so good!

The above was done in a test environment called ERP_TEST_IT2 (the DB is duplicated from ERP_LIVE, our live DB, but running off the same filesystem files). Before making any more changes, I want to duplicate this test environment to ERP_TEST_IT3 - I did so via the Manage Databases link on the login page, and having successully supplied the Master password I can see that the new DB instance has been created (and I can see the boolean field in hr_expense_line, as expected).

However, when I try to login to the new ERP_TEST_IT3 environment, I get the following error message:

Client Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/openerp/addons/web/http.py", line 204, in dispatch
    response["result"] = method(self, **self.params)
  File "/usr/lib/pymodules/python2.7/openerp/addons/web/controllers/main.py", line 864, in authenticate
    req.session.authenticate(db, login, password, env)
  File "/usr/lib/pymodules/python2.7/openerp/addons/web/session.py", line 115, in authenticate
    uid = self.proxy('common').authenticate(db, login, password, env)
  File "/usr/lib/pymodules/python2.7/openerp/addons/web/session.py", line 30, in proxy_method
    result = self.session.send(self.service_name, method, *args)
  File "/usr/lib/pymodules/python2.7/openerp/addons/web/session.py", line 103, in send
    raise xmlrpclib.Fault(openerp.tools.ustr(e), formatted_info)

Server Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/openerp/addons/web/session.py", line 89, in send
    return openerp.netsvc.dispatch_rpc(service_name, method, args)
  File "/usr/lib/pymodules/python2.7/openerp/netsvc.py", line 296, in dispatch_rpc
    result = ExportService.getService(service_name).dispatch(method, params)
  File "/usr/lib/pymodules/python2.7/openerp/service/web_services.py", line 433, in dispatch
    return fn(*params)
  File "/usr/lib/pymodules/python2.7/openerp/service/web_services.py", line 444, in exp_authenticate
    res_users = pooler.get_pool(db).get('res.users')
  File "/usr/lib/pymodules/python2.7/openerp/pooler.py", line 49, in get_pool
    return get_db_and_pool(db_name, force_demo, status, update_module)[1]
  File "/usr/lib/pymodules/python2.7/openerp/pooler.py", line 33, in get_db_and_pool
    registry = RegistryManager.get(db_name, force_demo, status, update_module)
  File "/usr/lib/pymodules/python2.7/openerp/modules/registry.py", line 203, in get
  File "/usr/lib/pymodules/python2.7/openerp/modules/registry.py", line 233, in new
    openerp.modules.load_modules(registry.db, force_demo, status, update_module)
  File "/usr/lib/pymodules/python2.7/openerp/modules/loading.py", line 350, in load_modules
    force, status, report, loaded_modules, update_module)
  File "/usr/lib/pymodules/python2.7/openerp/modules/loading.py", line 256, in load_marked_modules
    loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules, perform_checks=perform_checks)
  File "/usr/lib/pymodules/python2.7/openerp/modules/loading.py", line 161, in load_module_graph
    models = pool.load(cr, package)
  File "/usr/lib/pymodules/python2.7/openerp/modules/registry.py", line 118, in load
    model = cls.create_instance(self, cr)
  File "/usr/lib/pymodules/python2.7/openerp/osv/orm.py", line 883, in create_instance
    'You may need to add a dependency on the parent class\' module.' % (name, parent_name))
TypeError: The model "hr.expense.line" specifies an unexisting parent class "hr.expense.line"
You may need to add a dependency on the parent class' module.

I then get "Invalid username or password".

Flicking back to ERP_TEST_IT2 I can log in fine.

Is there a trick to duplicating a DB with custom modules?

I've seen posts for similar errors, although not related to having duplicated the DB:




but unfortunately no answers.

Any pointers greatly appreciated, as I've tried deleting and re-duplicating the DB but to no avail.



Ludo - 21South

--Ludo - 21South--
| 2 2 5
Zwijndrecht, Netherlands
--Ludo - 21South--


Ludo - 21South
On 10/14/14, 10:18 AM

A thing to try:

  • pg_dump the database commandline (use format=c , no-owner / etc.)
  • create database clone in psql
  • pg_restore the database into just-created database
  • run odoo with flag "-d clone -u all", which loads your database and tries to update all modules

Have you tried creating a new empty database and then installing your module as well?

Will try this - but being new to postgresql I'm not up to speed with the syntax on the command line etc. (I've been using pgAdmin III to view the schema etc).

Paul Strinati
on 10/14/14, 10:40 AM

Haven't forgotten about this - have just built a new server and restored our live db from backup, so will hopefully be able to try the above later today - will let you know how it goes!

Paul Strinati
on 10/20/14, 5:16 AM

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.


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

1 follower(s)


Asked: 10/14/14, 9:29 AM
Seen: 1131 times
Last updated: 3/16/15, 8:10 AM