class mk_link_student(models.Model):
_name = 'mk.link.student'
_description = 'Link Student With Stage'
_rec_name = 'name_stage_id'
name_stage_id = fields.Many2one(
'mk.stage',string='Name Stage',
)
remain_num = fields.Integer(
string='Remaining number',
compute='total_student'
student_ids = fields.Many2many('mk.student.register', string = 'Student')
i want compute field in remain_number depend on student_ids field many2many
@api.one
@api.depends('student_ids')
def total_student(self):
max_n = self.name_stage_id.max_number
for rec in self:
student = rec.student_ids.ids
if student:
result = max_n - student
and give me this Error:
result = max_n - student TypeError: unsupported operand type(s) for -: 'int' and 'list'