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

Hi,

I've got quite a few instances, where I would need to filter out a Many2One selection field (the example I will use is 'Maintenance Category')


I would like to only show all Machines & Tools that fit into the 'Hand Tools' category, so that my employees have a pre-filtered list to select from. Is this something that I can add?

Thanks in advance

อวตาร
ละทิ้ง
ผู้เขียน

Hi, Has anyone got any ideas with this?

คำตอบที่ดีที่สุด

Hi Ant,

Please find code in comment. 

Hope it will be helpful to you.

Thanks & Regards,
Email: odoo@aktivsoftware.com 

Skype: kalpeshmaheshwari

อวตาร
ละทิ้ง

Please find code here :-

For this you need to do add a domain in your Many2One like

product_id = fields.Many2one('product.product', string='Product', required=True,
domain=[('categ_id.name', '=', 'Software')])

In place of categ_id, write your category field name with .name to check by name(Ex: categ_id.name) and your value 'Hand Tools'

domain=[('your_categ_field_id.name', '=', 'Hand Tools')]

Feel free to contact us for further assistance

Related Posts ตอบกลับ มุมมอง กิจกรรม
0
ต.ค. 20
3554
1
ส.ค. 17
4070
0
มี.ค. 15
3364
1
มี.ค. 15
6501
2
ส.ค. 23
7398