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

Hello Odoo community,

I was wondering is it possible that let say i have 2 fields res_partner_id which is many2one and phone_numbers which is selection.

so if i change res_partner_id it will populate my phone_numbers list. OR onchange phone_numbers selection but selection will be populated based on res_partner_id. On Openerp version 7

On version 8 it looks something like this but how do i the same on version 7?

 name = fields.Selection(selection='_get_selection' string='name')

@api.onchange('name')
def _get_selection(self):
     choise = []
     ret_ids = self.env['env'].search([])
     for amen_id in ret_ids:
         choise.append((str(amend_id.name),str(amen_id.name)))
     return choise

Any examples and Ideas would be appreciated

Thank you,

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

Selection fields won't be able to change it's value using onchange, switch to a many2one if you wanna do it where you could apply a domain to the field restricting the values to select. With selection fields you can't do that

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
1
ديسمبر 15
6917
1
نوفمبر 15
5697
2
يوليو 22
4709
4
ديسمبر 19
7507
1
يناير 16
4709