Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
3 ตอบกลับ
4406 มุมมอง

Hello everyone,

I would like to add a conditional field B containing a list. However, the the values of this list depend on another field A

To be more clear, the field A is a Many2one containing the values A1 and A2. If A1 is selected, the field B should list all the records in 'res.partner', otherwise, it should list the records of 'hr.employee'.

Is there a way in odoo to implement this case ?

Thank you for your help

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Did you get this to work Zakaria? Do you know if it also work for the helpdesk app?

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

You can do two field one for 'res.partner' and another one for 'hr.employee' and use attrs to make these field visible depending on Value on field A.


Another solution may be work , you can define field B as reference field

อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

Thank you Mahmoud for your answer,

I have tried the first solution. I tried to hide a field defined inside a notebook page. However, the field is disabled and not hidden!

The second solution that you have suggested "fields.Reference" is exactly what I am looking for! However, I am struggling using it as I have not found much documentation about it. Is there a way to access from a function to one of the models defined in it and hide it?

Thank you again

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ก.ย. 23
6348
3
มี.ค. 23
6309
2
พ.ย. 22
4739
1
ม.ค. 22
11963
8
พ.ย. 16
3940