Skip to Content
Odoo Meniu
  • Autentificare
  • Try it free
  • Aplicații
    Finanțe
    • Contabilitate
    • Facturare
    • Cheltuieli
    • Spreadsheet (BI)
    • Documente
    • Semn
    Vânzări
    • CRM
    • Vânzări
    • POS Shop
    • POS Restaurant
    • Abonamente
    • Închiriere
    Site-uri web
    • Constructor de site-uri
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Lanț Aprovizionare
    • Inventar
    • Producție
    • PLM
    • Achiziție
    • Maintenance
    • Calitate
    Resurse Umane
    • Angajați
    • Recrutare
    • Time Off
    • Evaluări
    • Referințe
    • Flotă
    Marketing
    • Social Marketing
    • Marketing prin email
    • SMS Marketing
    • Evenimente
    • Automatizare marketing
    • Sondaje
    Servicii
    • Proiect
    • Foi de pontaj
    • Servicii de teren
    • Centru de asistență
    • Planificare
    • Programări
    Productivitate
    • Discuss
    • Aprobări
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Aplicații Terțe Odoo Studio Platforma Odoo Cloud
  • Industrii
    Retail
    • Book Store
    • Magazin de îmbrăcăminte
    • Magazin de Mobilă
    • Magazin alimentar
    • Magazin de materiale de construcții
    • Magazin de jucării
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Distribuitor de băuturi
    • Hotel
    Proprietate imobiliara
    • Real Estate Agency
    • Firmă de Arhitectură
    • Construcție
    • Estate Managament
    • Grădinărit
    • Asociația Proprietarilor de Proprietăți
    Consultanta
    • Firma de Contabilitate
    • Partener Odoo
    • Agenție de marketing
    • Law firm
    • Atragere de talente
    • Audit & Certification
    Producție
    • Textil
    • Metal
    • Mobilier
    • Mâncare
    • Brewery
    • Cadouri corporate
    Health & Fitness
    • Club Sportiv
    • Magazin de ochelari
    • Centru de Fitness
    • Wellness Practitioners
    • Farmacie
    • Salon de coafură
    Trades
    • Handyman
    • IT Hardware and Support
    • Asigurare socială de stat
    • Cizmar
    • Servicii de curățenie
    • HVAC Services
    Altele
    • Organizație nonprofit
    • Agenție de Mediu
    • Închiriere panouri publicitare
    • Fotografie
    • Închiriere biciclete
    • Asigurare socială
    Browse all Industries
  • Comunitate
    Învăță
    • Tutorials
    • Documentație
    • Certificări
    • Instruire
    • Blog
    • Podcast
    Empower Education
    • Program Educațional
    • Scale Up! Business Game
    • Visit Odoo
    Obține Software-ul
    • Descărcare
    • Compară Edițiile
    • Lansări
    Colaborați
    • Github
    • Forum
    • Evenimente
    • Translations
    • Devino Partener
    • Services for Partners
    • Înregistrează-ți Firma de Contabilitate
    Obține Servicii
    • Găsește un Partener
    • Găsiți un contabil
    • Meet an advisor
    • Servicii de Implementare
    • Referințe ale clienților
    • Suport
    • Actualizări
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obține un demo
  • Prețuri
  • Ajutor

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Contabilitate
  • Inventar
  • PoS
  • Proiect
  • MRP
All apps
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Suport

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

Abonare

Primiți o notificare când există activitate la acestă postare

Această întrebare a fost marcată
4 Răspunsuri
28014 Vizualizări
Imagine profil
Shaun Dawson

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:

__init__.py:

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

__openerp__.py:

# -*- 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'
    }

dev_person()


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),
    }

dev_property()

And dev_view.xml:

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

<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>

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

<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" />

</data>
</openerp>

Any thoughts?

1
Imagine profil
Abandonează
Imagine profil
Atul Makwana
Cel mai bun răspuns

if you get the error Invalid model name in the action definition, check the followings

  1. check the model name in the model file you have defined.

  2. In __init__.py file whether the model file is imported or not. 

  3. check for the dependency (in most cases when you use <act_window )

1
Imagine profil
Abandonează
Imagine profil
Shaun Dawson
Autor Cel mai bun răspuns

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.

1
Imagine profil
Abandonează
Imagine profil
Ghanshyam Prajapati
Cel mai bun răspuns

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.

1
Imagine profil
Abandonează
Shaun Dawson
Autor

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).

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Înscrie-te
Comunitate
  • Tutorials
  • Documentație
  • Forum
Open Source
  • Descărcare
  • Github
  • Runbot
  • Translations
Servicii
  • Hosting Odoo.sh
  • Suport
  • Actualizare
  • Custom Developments
  • Educație
  • Găsiți un contabil
  • Găsește un Partener
  • Devino Partener
Despre Noi
  • Compania noastră
  • Active de marcă
  • Contactați-ne
  • Locuri de muncă
  • Evenimente
  • Podcast
  • Blog
  • Clienți
  • Aspecte juridice • Confidențialitate
  • Securitate
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo este o suită de aplicații de afaceri open source care acoperă toate nevoile companiei dvs.: CRM, comerț electronic, contabilitate, inventar, punct de vânzare, management de proiect etc.

Propunerea de valoare unică a Odoo este să fie în același timp foarte ușor de utilizat și complet integrat.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now