Skip to Content
Menu
This question has been flagged
1 Reply
1902 Views

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?


Avatar
Discard
Related Posts Replies Views Activity
3
Mar 18
8730
0
Mar 15
2390
0
Mar 15
3242
1
Mar 15
4582
1
Sep 24
131