from odoo import fields, models class McGuardian(models.Model): _name = "mc.guardian" _inherit = ["mail.thread"] _description = "Guardian" _order = "name" _rec_name = "name" partner_id = fields.Many2one( "res.partner", string="Contact", required=True, ondelete="restrict", ) name = fields.Char(string="Name", required=True, tracking=True) occupation = fields.Char(string="Occupation") phone = fields.Char(string="Phone") email = fields.Char(string="Email") student_link_ids = fields.One2many( "mc.student.guardian", "guardian_id", string="Children", ) _partner_uniq = models.Constraint( "unique(partner_id)", "This contact already has a guardian record.", )