Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
1753 Zobrazení
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
Zrušit
Nejlepší odpověď

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
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
2
dub 24
2791
2
led 24
1240
1
led 22
3381
0
pro 15
5233
0
bře 15
4558