Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
1 Відповісти
1734 Переглядів
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

Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
2
квіт. 24
2784
2
січ. 24
1225
1
січ. 22
3375
0
груд. 15
5226
0
бер. 15
4551