i have many2one field want id of selected value
service = fields.many2one('mainservices.mtvehlog', string='select service(s)')
so onchange want know id , after knowing (i want make other fields invisible)
what if many2one multi selection? how id's have been selected?
@api.depends('service') def _compute_hide(self): source_obj=self.pool.get('mainservices.mtvehlog').browse(self.service) if source_obj == '1': self.services_selected = source_obj self.hide = true else: self.services_selected = source_obj self.hide = false
kindly help
in compute methods using depends decorator loop throuth self first.
rec in self: # , how id value #you don't have browse have direct acces properties of selected value if rec.service.id == somthing : # , not except singlton error
you question not clear want id value exactly.
Comments
Post a Comment