Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
2 Răspunsuri
2785 Vizualizări
Hello, how could I limit the number of records shown by a many to one field and order the selection?


Imagine profil
Abandonează
Cel mai bun răspuns

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

Imagine profil
Abandonează
Cel mai bun răspuns
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)]} }
Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
1
apr. 24
1744
1
iul. 20
8671
2
iul. 18
8589
1
ian. 22
3378
0
dec. 15
5226