Thank you very much it worked very well for me. but now I have another problem since I want to relate the models class with the brands class and when doing the inheritance it adds all the fields of the class.
from odoo import models, fields, api
class gestion_marcas(models.Model):
_name = 'gestion_vehiculos.gestion_marcas'
_rec_name='marcas'
marcas = fields.Char(string='Marca')
marca_id = fields.Integer(string='Id de Marca')
class gestion_modelo(models.Model):
_name = 'gestion_vehiculos.gestion_modelo'
_inherit = 'gestion_vehiculos.gestion_marcas' ## this is the inheritance
_rec_name='modelos'
id_modelo =fields.Integer(string="ID de Modelo")
modelos = fields.Char(string='modelos')
marcas_id = fields.Many2one('Gestion_vehiculos.gestion_marcas',string='Marca')##this is the field that will relate the two tables
class gestion_vehiculos(models.Model):
_name = 'gestion_vehiculos.gestion_vehiculos'
_inherit = {'gestion_vehiculos.gestion_marcas' ,'gestion_vehiculos.gestion_modelo'}
_rec_name='placa'
marca = fields.Many2one('gestion_vehiculos.gestion_marcas',string='Marca')
modelo = fields.Many2one('gestion_vehiculos.gestion_modelo',string='Modelo')
dateto = fields.Integer(string='Año')
color = fields.Char(string='Color')
placa = fields.Char(string='Placa') vin = fields.Char(string='Vin')
solution 1: you must use name field in your model
solution 2: if you havn't name field than use _rec_name = 'some_field', in your model