Se rendre au contenu
Menu
Cette question a été signalée
1 Répondre
1751 Vues
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
Ignorer
Meilleure réponse

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
Ignorer
Publications associées Réponses Vues Activité
2
avr. 24
2790
2
janv. 24
1236
1
janv. 22
3380
0
déc. 15
5233
0
mars 15
4558