コンテンツへスキップ
メニュー
この質問にフラグが付けられました
2 返信
2811 ビュー
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)]} }
アバター
破棄
関連投稿 返信 ビュー 活動
1
4月 24
1772
1
7月 20
8727
2
7月 18
8625
1
1月 22
3409
0
12月 15
5267