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

The view from the another menu data is not shown.

from odoo import models, fields, api


class TeacherSubject(models.Model):
_name = 'teacher.subject.record'
_description = 'Teacher Subject record'
_inherit = ["mail.thread"]



#ts_id = fields.Integer( string='Teacher..', tracking=True)
ts_ids = fields.Many2one('record.student')
name_teacher = fields.Many2one('record.teacher', string='Teacher')
teacher_subject = fields.Many2one('record.subject', string='Subject')


@api.onchange('name_teacher')
def onchange_name_teacher(self):
for rec in self:
return {'domain': {'teacher_subject': [('name_teacher', '=', rec.name_teacher.teacher_subject.ids)]}}


error:
   raise ValueError("Invalid field %s.%s in leaf %s" % (model._name, path[0], str(leaf)))
ValueError: Invalid field record.subject.name_teacher in leaf ('name_teacher', 'in', [6, 7])
Avatar
Discard

check code for record.subject model. Make sure it contains field name_teacher.
If it have the field, try restarting your Odoo instance and upgrade the module containing record.subject model

Best Answer

Hi

Please check whether this helps


@api.onchange('name_teacher')
def onchange_name_teacher(self):
for rec in self:
return {'domain': {'teacher_subject': [('name_teacher.id', '=', rec.name_teacher.id)]}}

Regards



Avatar
Discard
Related Posts Replies Views Activity
2
Mar 24
571
0
Feb 24
1196
2
Aug 23
1709
0
Jan 23
704
1
Nov 22
1760