Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
2 Replies
3206 Tampilan
Hello, how could I limit the number of records shown by a many to one field and order the selection?


Avatar
Buang
Jawaban Terbai

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
Buang
Jawaban Terbai
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
Buang
Post Terkait Replies Tampilan Aktivitas
1
Apr 24
1962
1
Jul 20
9023
2
Jul 18
8973
1
Jan 22
3662
0
Des 15
5591