Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
1761 Vistas
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
Descartar
Mejor respuesta

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
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
2
abr 24
2798
2
ene 24
1249
1
ene 22
3382
0
dic 15
5239
0
mar 15
4579