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.


Cannot execute name_create, no _rec_name defined

on 5/4/15, 4:49 AM 971 views

Hi guys,

I've created a custom module with two classes in one file. The first class inherits a model and adds fields, the second class creates a new model:

# -*- coding: utf-8 -*-
from openerp import models, fields, api
class aa_custom_module(models.Model):
    _inherit = 'fleet.vehicle'
    NumberPlate2 = fields.Char('Second number plate')
    SoortOpleggerIds = fields.Many2many('fleet.vehicle.oplegger.soort', 'fleet_soort_oplegger_rel', 'oplegger_oplegger_id', 'oplegger_id', 'Soort Oplegger', required=True)

class fleet_oplegger_tag(models.Model):
    _name = 'fleet.vehicle.oplegger.soort'
    _description = 'Soort van oplegger'
    Name = fields.Char('Name', required=True, translate=True) 

SoortOpleggerIds is a Many2many field which is defined as a widget for tags in the view:

<field name="SoortOpleggerIds" widget="many2many_tags"/> 

The problem is that when I now want to create/add a new record to the Many2many SoortOpleggerIds I will get the following error:

 2015-05-04 08:44:25,357 19326 WARNING test-db openerp.models: Cannot execute name_search, no _rec_name defined on fleet.vehicle.oplegger.soort
So, why am I getting this error? What have I done wrong?




| 7 7 8
Turnhout, Belgium

My Odoo blog: http://www.odoo.yenthevg.com/

My Twitter: https://twitter.com/Yenthe666

On 5/4/15, 5:13 AM

Hi guys,

Turns out you need to have a field named 'name', exactly 'name'. No capitals, nothing else. So this fixed it:

 class fleet_oplegger_tag(models.Model):
    _name = 'fleet.vehicle.oplegger.soort'
    _description = 'Soort van oplegger'
    name = fields.Char('Name', required=True, translate=True)

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

1 follower(s)


Asked: 5/4/15, 4:49 AM
Seen: 971 times
Last updated: 5/4/15, 5:50 AM