How can I filter a Many2One relation?
I have a form view that create instance of custom model DirectMessage. Each message can only have one receiver (User), but each receiver can have multiple messages sent to them.
I can't quite figure out how to restrict the dropdown menu with User model entries to only users with specific field values that aren't the current user who tries to create new DirectMessage
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- إدارة علاقات العملاء
- e-Commerce
- المحاسبة
- المخزون
- PoS
- Project
- MRP
لقد تم الإبلاغ عن هذا السؤال
1
الرد
643
أدوات العرض
You can add a domain in field that your are trying to filter in Form view to achieve this.
هل أعجبك النقاش؟ لا تكن مستمعاً فقط. شاركنا!
أنشئ حساباً اليوم لتستمتع بالخصائص الحصرية، وتفاعل مع مجتمعنا الرائع!
تسجيل
Please refer to this forum answer.
https://www.odoo.com/forum/help-1/odoo-14-how-i-can-set-domain-filter-on-many2one-type-field-181671
You can understand how to add a domain to the Many2One field from that answer.