Odoo Help


This community 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.


Why am I getting "Invalid model name in the action definition"?

Shaun Dawson
on 5/30/13, 3:22 AM 4,032 views

I'm new to OpenERP, and I've been trying to create a custom module. A trivial module with a single model works fine, but as soon as I try to add a second model (with a view), I get an "Invalid model name in the action definition" error on import.

I am using OpenERP 7.0-20130524-231019, installed using apt-get on a Ubuntu server.

If I comment out the view, the model will import fine, but the second model doesn't appear in to Model list, so I'm sure that the error is legit, but why isn't the second module actually being created?

My files are as follows:


# -*- coding: utf-8 -*-
import dev


# -*- coding: utf-8 -*-

    "name" : "Dev module",
    "version" : "0.1",
    "author" : "Dev",
    'complexity': "easy",
    "description" : """
This is a test

This is only a test.
    "website" : "[a real URL]",
    "depends" : [],
    "category" : "Dev",
    "sequence": 16,
    "init_xml" : [],
    "demo_xml" : [],
    "update_xml" : ["dev_view.xml",],
    'test': [],
    'installable': True,
    'application': True,
    'active': False,

Here's the .py:

class dev_person(osv.Model):
    _name = "dev.person"
    _description = "Person"
    _columns = {
        'name': fields.char('Person Name', size=128, required=True),
        'properties': fields.one2many('dev.property', 'property_id', 'Properties'


class dev_property(osv.Model):
    _name = "dev.property"
    _description = "Property"
    _columns = {
        'name': fields.char('Property Name', size=128, required=True),
        'property_id': fields.many2one('dev.person', 'Person Name', select=True),


And dev_view.xml:

<?xml version="1.0" encoding="utf-8"?>

<record model="ir.actions.act_window" id="action_dev_person_form">
<field name="name">dev_person</field>
<field name="res_model">dev.person</field>

<record model="ir.actions.act_window" id="action_dev_property_form">
<field name="name">dev_property</field>
<field name="res_model">dev.property</field>

<menuitem name="Dev" icon="terp-project" id="dev_menu" />
<menuitem name="Dev" parent="dev_menu" id="dev_menu_header" />

<menuitem name="Person" parent="dev_menu_header" id="dev_menu_person" action="action_dev_person_form" />
<menuitem name="Property" parent="dev_menu" id="dev_menu_property" action="action_dev_property_form" />


Any thoughts?

Shaun Dawson
On 5/30/13, 1:28 PM

I believe that I've solved it.

It turns out that I had a bug in my module's .py file that kept it from compiling (that bug is present in the examples I gave... there's a missing end parenthesis).

This prevented any models from working, except for one model, dev.person, and I'm not sure why.

I finally noticed the problem when I got a compile error on trying to update the openerp package using apt-get. Once I saw that, I fixed the bug, and then started using the command line to update my modules rather than the Web UI. I also made sure that the openerp python process was actually dead when I stopped the server. Serveral times, it wasn't, and the process had to be killed.

Now that I am using openerp -d <database> --update <module>, I'm getting the expected behavior.


Ghanshyam Prajapati

--Ghanshyam Prajapati--
| 4 4 8
Pune, India
--Ghanshyam Prajapati--
OpenERP Developer
Ghanshyam Prajapati
On 5/30/13, 9:28 AM

Hey Shaun,

I just install your custom module, it works fine without error, i think problem is in your __init__.py file.

have you imported your py file in __init__.py ??? for example, suppose you have py file named test.py, have you imported your py file in __init__.py???

in __init__.py,

import test

The second one problem is, i cant see any view of dev.property object,

I suggest you to make seperate form view, tree view, search view of dev.person object and dev.property object.

Thanks for your response, Ghanshyam! I've edited the question to include my __init__.py, and the rest of the files in the module as well. I definitely am including my module's .py in the import statement (and the other model, which is defined in that same module does successfully get imported).

Shaun Dawson
on 5/30/13, 12:00 PM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)


Asked: 5/30/13, 3:22 AM
Seen: 4032 times
Last updated: 4/8/15, 6:20 AM