Hi,
Please try following code,
Models → .py file
from odoo import models, fields
class Level(models.Model):
_name = 'gc.level'
name = fields.Char(string='Degree', required=True)
note = fields.Integer(string="Note", required=True)
description = fields.Text(string="Description")
critere_id = fields.Many2one('gc.criteria', string="Criteria")
class Criteria(models.Model):
_name = 'gc.criteria'
name = fields.Char(string='Critère')
levels_ids = fields.One2many('gc.level', 'critere_id', string="Degree")
Views → .xml file
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="view_gc_criteria_form" model="ir.ui.view">
<field name="name">gc.criteria.form</field>
<field name="model">gc.criteria</field>
<field name="arch" type="xml">
<form>
<sheet>
<field name="name"/>
<div>
<group>
<field name="levels_ids">
<field name="name"/>
<field name="note"/>
<field name="description"/>
<field name="critere_id" invisible="1"/>
</field>
</group>
</div>
</sheet>
</form>
</field>
</record>
<record id="gc_criteria_tree_view" model="ir.ui.view">
<field name="name">gc.criteria.tree</field>
<field name="model">gc.criteria</field>
<field eval="8" name="priority"/>
<field name="arch" type="xml">
<tree string="Test Email">
<field name="name" string="Reference"/>
<field name="levels_ids"/>
</tree>
</field>
</record>
<record id="action_gc_criteria_form" model="ir.actions.act_window">
<field name="name">Gc Criteria</field>
<field name="res_model">gc.criteria</field>
<field name="view_mode">tree,kanban,form</field>
</record>
<menuitem action="action_gc_criteria_form" name="Gc Criteria"
id="menu_action_gc_criteria" string="Gc Criteria" parent="parent_module.menu_id" sequence="4"/>
</data>
</odoo>
Security → .csv file
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_gc_criteria,test_email.gc_criteria,model_gc_criteria,base.group_user,1,1,1,1
access_gc_level,test_email.gc_level,model_gc_level,base.group_user,1,1,1,1
Regards