Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odpovědi
2793 Zobrazení
Hello, how could I limit the number of records shown by a many to one field and order the selection?


Avatar
Zrušit
Nejlepší odpověď

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

Avatar
Zrušit
Nejlepší odpověď
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)]} }
Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
1
dub 24
1757
1
čvc 20
8687
2
čvc 18
8597
1
led 22
3381
0
pro 15
5235