openerp - Odoo 10 getting the id of the selected value of many2one -


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

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -