Field Service

0

dropdown depends on other dropdown

Avatar
Nejatins

hi,

I want to have a drop-down that will fill after I select an Item in other drop-down.

I have a function that contains all my other fields and I want to fill this drop-down in this function. how can I do this?

class kipoHelpdeskOs(models.Model):

_name = 'kipo.helpdesk.create.os'

name = fields.Char()


class KipoHelpdeskDevices(models.Model):

_name = 'kipo.helpdesk.create.devices'

name = fields.Char()os_id = fields.Many2one('kipo.helpdesk.create.os')



class KipoHelpdeskCreate(models.Model):

_name = 'kipo.helpdesk.create'

customer_name = fields.Char(string='Customer Name')

os_id = fields.Many2one('kipo.helpdesk.create.os', string='Os')

device_id = fields.Many2one('kipo.helpdesk.create.devices'

@api.multi

def create_helpdesk_card(self):

condition = [('name', '=', 'Helpdesk')]

res = self.env['project.project'].search(condition)

if len(res) != 0:

projectId = res[0]['id']

if self.customer_name == False:

customerName = ''

else:

customerName = str(self.customer_name)


os = ''

condition = [('id'), '=', int(self.os_id)]

res = self.env['kipo.helpdesk.create.os'].search(condition)

if len(res) != 0:

os = res[0]['name']


Here is where I want to use api.onchange:

device = ''

condition = [('os', '=', int(self.os_id))]

res = self.env['kipo.helpdesk.create.devices'].search(condition)

if len(res) != 0:

device = res[0]['name']

 (this function returns some thing ...)

what should I do?


Аватар
Відмінити
1 Відповідь
1
Avatar
Niyas Raphy
Найкраща відповідь

Hi,

See this Video: Return Dynamic Domain For Field In Odoo

Thanks

Аватар
Відмінити