I am trying to generate different selection choices depending on other field in the Model. I am working in Odoo 8. Below is the code :
My Model: (test.py)
type = fields.Selection(selection='_get_selection', string='Type')
@api.onchange('role_name')
def _get_selection(self):
choise = []
if self.role_name == 'primary':
choise.append(('unit','Unit Case'))
if self.role_name == 'reserve':
choise.append(('res','Reserve Case'))
return choise
The View: (template.xml)
<field name="type" widget="selection"/>
But i don't see any values in Selection Field.
Please Help.
Thanks,