Skip to Content
Menu
This question has been flagged
1 Reply
2954 Views

from odoo import api, fields, models, _


class Course(models.Model):

_name = 'academic.course'

_rec_name = 'name'

name = fields.Char("Name")

description = fields.Text(string="Description", required=False, )

responsible_id = fields.Many2one(comodel_name="res.users", string="Responsible")

session_ids = fields.One2many(comodel_name="academic.session", inverse_name="course_id", string="Session", required=False, ondelete="cascade")

Avatar
Discard
Best Answer

Hi indar,

Course_id must be declared in academic.session object with M2O signature. 
Like this : 

class CourseSessions(models.Model):
_name = 'academic.session'

course_id = fields.Many2one('academic.course', string="Course") 

Avatar
Discard