Hello, how could I limit the number of records shown by a many to one field and order the selection?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Hello, how could I limit the number of records shown by a many to one field and order the selection?
Hi,
You can use this module from OCA.It lets you define the number of records to be shown from settings.
https://apps.odoo.com/apps/modules/16.0/web_m2x_options/
Hope it helps
Try this for limit and ordered records,
@api.onchange('many2one_field') def limit_many2one_records(self): limit = 5 limited_records = self.env['related.model'].search([], limit=limit,order='order_field') return { 'domain': {'many2one_field': [('id', 'in', limited_records.ids)]} }
Create an account today to enjoy exclusive features and engage with our awesome community!
Üye Olİlgili Gönderiler | Cevaplar | Görünümler | Aktivite | |
---|---|---|---|---|
|
1
Nis 24
|
1730 | ||
|
1
Tem 20
|
8667 | ||
|
2
Tem 18
|
8570 | ||
|
1
Oca 22
|
3373 | ||
|
0
Ara 15
|
5211 |