Hello, I would like to know a way to order and limit the number of records in a list of a many to one field in Odoo 13 many2one field: aprob_id order_by: name limit: 5 records
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Hello, I would like to know a way to order and limit the number of records in a list of a many to one field in Odoo 13 many2one field: aprob_id order_by: name limit: 5 records
Hi,
Use the following code to limit and order the records in the many2one field.
@api.onchange('aprob_id')
def _onchange_aprob_id(self):
limited_records = self.env['related.model'].search([], limit=5,order='name')
return {
'domain': {'aprob_id': [('id', 'in', limited_records.ids)]}
}
Hope it helps
Create an account today to enjoy exclusive features and engage with our awesome community!
Üye Olİlgili Gönderiler | Cevaplar | Görünümler | Aktivite | |
---|---|---|---|---|
|
2
Nis 24
|
2781 | ||
|
2
Oca 24
|
1224 | ||
|
1
Oca 22
|
3373 | ||
|
0
Ara 15
|
5211 | ||
|
0
Mar 15
|
4550 |