compute field is that field which it's value computed by function , so we can make it by the following steps
- create the field and link it with function that will compute it's value
E.G .
student_number = fields.Integer(string="Student Number", compute='get_student_number')
- create the function to compute the value
E.G .
@api.one
def get_student_number(self):
student_ids = self.env['student.student'].search([])
counter = 1
for rec in student_ids:
counter = counter+1
self.student_number = counter
* the function will call automatically when we create record
Watch On YouTube
Watch On YouTube
No comments:
Post a Comment