Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
1 Balas
1747 Tampilan
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


Avatar
Buang
Jawaban Terbai

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

Avatar
Buang
Post Terkait Replies Tampilan Aktivitas
2
Apr 24
2788
2
Jan 24
1235
1
Jan 22
3379
0
Des 15
5226
0
Mar 15
4557