تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
2678 أدوات العرض

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?


الصورة الرمزية
إهمال
أفضل إجابة

Hi,

See this Video: Return Dynamic Domain For Field In Odoo

Thanks

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
3
مارس 18
9799
0
مارس 15
3102
0
مارس 15
4069
1
مارس 15
5538
1
سبتمبر 24
1153