Hello everyone, i try to install my first module to school, don´t work and I don´t know why. The mistake is ¨module not found¨. I paste here the error and the code to models.py and views.xml. Thank you.
---MISTAKE---
Modelo no encontrado: al.taller.propietarios Contexto del error: Vista `taller.propietarios.tree` [view_id: 1020, xml_id: n/a, model: al.taller.propietarios, parent_id: n/a] None" while parsing /opt/odoo/odoo11/custom-addons/taller/views/views.xml:6, near <record model="ir.ui.view" id="taller_propietarios_tree"> <field name="name">taller.propietarios.tree</field> <field name="model">al.taller.propietarios</field> <field name="arch" type="xml"> <tree> <field name="name"/> <field name="nombre"/> <field name="apellido1"/> <field name="apellido2"/> </tree> </field> </record>
---MODELS.PY---
from odoo import models, fields, api
class taller_propietarios(models.Model):
_name="al.taller.propietarios"
name=fields.Char(string="DNI",required=True)
nombre=fields.Char(string="Nombre",required=True)
apellido1=fields.Char(string="Primer apellido",required=True)
apellido2=fields.Char(string="Segundo apellido",required=False)
coches = fields.One2many("al.taller.coches",'name',ondelete="cascade")
class taller_mecanicos(models.Model):
_name="al.taller.mecanicos"
name=fields.Char(string="Numero empleado",required=True)
nombre=fields.Char(string="Nombre",required=True)
puesto=fields.Selection((('0','Mecanico'),('1','Chapista'),('2','Jefe taller')),string="Puesto",required=True)
coches = fields.Many2many("al.taller.coches",string="Coches a su cargo")
class taller_coches(models.Model):
_name="al.taller.coches"
name=fields.Char(string="Matricula",required=True)
bastidor=fields.Char(string="Bastidor",required=True)
marca=fields.Char(string="Marca",required=True)
modelo=fields.Char(string="Modelo",required=True)
defectos=fields.Text(string="Defectos del vehiculo",required=True)
propietaros = fields.Many2one("al.taller.propietarios",string="Propietario",ondelete='cascade')
mecanicos = fields.Many2many("al.taller.mecanicos",string="Encargado/s del coche")
class taller_marcas(models.Model):
_name="al.taller.marcas"
name=fields.Char(string="Marca",required=True);
description=fields.Text(string="Descripcion",required=False)
modelos = fields.One2many("al.taller.modelos", string="Modelos", 'coches')
class taller_modelos(models.Model):
_name="al.taller.modelos"
name=fields.Char(string="Modelos")
marcas = fields.Many2one("al.taller.marcas",string="Modelos",ondelete='cascade')
---VIEWS.XML---
<odoo>
<data>
<!--PROPIETARIOS -->
<record model="ir.ui.view" id="taller_propietarios_tree">
<field name="name">taller.propietarios.tree</field>
<field name="model">al.taller.propietarios</field>
<field name="arch" type="xml">
<tree>
<field name="name"/>
<field name="nombre"/>
<field name="apellido1"/>
<field name="apellido2"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="taller_propietarios_form">
<field name="name">taller.propietarios.form</field>
<field name="model">al.taller.propietarios</field>
<field name="arch" type="xml">
<form>
<group colspan="2" col="2">
<field name="name"/>
<field name="nombre"/>
<field name="apellido1"/>
<field name="apellido2"/>
<field name="coches"/>
</group>
</form>
</field>
</record>
<!-- MECANICOS -->
<record model="ir.ui.view" id="taller_mecanicos_tree">
<field name="name">taller.mecanicos.tree</field>
<field name="model">al.taller.mecanicos</field>
<field name="arch" type="xml">
<tree>
<field name="name"/>
<field name="nombre"/>
<field name="puesto"/>
<field name="coches"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="taller_mecanicos_form">
<field name="name">taller.mecanicos.form</field>
<field name="model">al.taller.mecanicos</field>
<field name="arch" type="xml">
<form>
<group colspan="2" col="2">
<field name="name"/>
<field name="nombre"/>
<field name="puesto"/>
<field name="coches"/>
</group>
</form>
</field>
</record>
<!-- COCHES -->
<record model="ir.ui.view" id="taller_coches_tree">
<field name="name">taller.coches.tree</field>
<field name="model">al.taller.coches</field>
<field name="arch" type="xml">
<tree>
<field name="name"/>
<field name="bastidor"/>
<field name="marca"/>
<field name="modelo"/>
<field name="defectos"/>
<field name="propietarios"/>
<field name="mecanicos"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="taller_coches_form">
<field name="name">taller.coches.form</field>
<field name="model">al.taller.coches</field>
<field name="arch" type="xml">
<form>
<group colspan="2" col="2">
<field name="name"/>
<field name="bastidor"/>
<field name="marca"/>
<field name="modelo"/>
<field name="defectos"/>
<field name="propietarios"/>
<field name="mecanicos"/>
</group>
</form>
</field>
</record>
<!-- MARCAS -->
<record model="ir.ui.view" id="taller_marcas_tree">
<field name="name">taller.marcas.tree</field>
<field name="model">al.taller.marcas</field>
<field name="arch" type="xml">
<tree>
<field name="name"/>
<field name="description"/>
<field name="modelos"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="taller_marcas_form">
<field name="name">taller.marcas.form</field>
<field name="model">al.taller.marcas</field>
<field name="arch" type="xml">
<form>
<group colspan="2" col="2">
<field name="name"/>
<field name="description"/>
<field name="modelos"/>
</group>
</form>
</field>
</record>
<!-- MODELOS -->
<record model="ir.ui.view" id="taller_modelos_tree">
<field name="name">taller.modelos.tree</field>
<field name="model">al.taller.modelos</field>
<field name="arch" type="xml">
<tree>
<field name="name"/>
<field name="marcas"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="taller_modelos_form">
<field name="name">taller.modelos.form</field>
<field name="model">al.taller.modelos</field>
<field name="arch" type="xml">
<form>
<group colspan="2" col="2">
<field name="name"/>
<field name="marcas"/>
</group>
</form>
</field>
</record>
<!-- ACTIONS -->
<record model="ir.actions.act_window" id="taller.propietarios_action_window">
<field name="name">taller.propietarios.action_window</field>
<field name="res_model">al.taller.propietarios</field>
<field name="view_mode">tree,form</field>
</record>
<record model="ir.actions.act_window" id="taller.mecanicos_action_window">
<field name="name">taller.mecanicos.action_window</field>
<field name="res_model">al.taller.mecanicos</field>
<field name="view_mode">tree,form</field>
</record>
<record model="ir.actions.act_window" id="taller.coches_action_window">
<field name="name">taller.coches.action_window</field>
<field name="res_model">al.taller.coches</field>
<field name="view_mode">tree,form</field>
</record>
<record model="ir.actions.act_window" id="taller_marcas_action_window">
<field name="name">taller.marcas.action_window</field>
<field name="res_model">al.taller.marcas</field>
<field name="view_mode">tree,form</field>
</record>
<record model="ir.actions.act_window" id="taller_modelos_action_window">
<field name="name">taller.modelos.action_window</field>
<field name="res_model">al.taller.modelos</field>
<field name="view_mode">tree,form</field>
</record>
<!-- MENU -->
<menuitem name="Taller" id="taller.menu_root" />
<menuitem name="Propietarios" id="taller.propietarios_menu" parent="taller.menu_root" action="taller.propietarios_action_window" />
<menuitem name="Mecanicos" id="taller.mecanicos_menu" parent="taller.menu_root" action="taller.mecanicos_action_window"/>
<menuitem name="Coches" id="taller.coches_menu" parent="taller.menu_root" action="taller.coches_action_window" />
<menuitem name="Marcas" id="taller.marcas_menu" parent="taller.menu_root" action="taller.marcas_action_window" />
<menuitem name="Modelos" id="taller.modelos_menu" parent="taller.menu_root" action="taller.modelos_action_window" />
</data>
</odoo>
Follow these tips: http://learnopenerp.blogspot.com/