Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
2 Risposte
2809 Visualizzazioni
Hello, how could I limit the number of records shown by a many to one field and order the selection?


Avatar
Abbandona
Risposta migliore

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
Abbandona
Risposta migliore
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
Abbandona
Post correlati Risposte Visualizzazioni Attività
1
apr 24
1772
1
lug 20
8726
2
lug 18
8622
1
gen 22
3409
0
dic 15
5267