Tuesday, August 20, 2019

create compute field in odoo

odoo

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


No comments:

Post a Comment

Odoo Invoice Qr code issues

There are two main issues must of us facing with the QR code in Odoo invoice & these issues are 1/ QR code displayed as broken image w...