Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
3023 มุมมอง
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)]} }
อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
เม.ย. 24
1883
1
ก.ค. 20
8869
2
ก.ค. 18
8799
1
ม.ค. 22
3518
0
ธ.ค. 15
5422