diff --git a/odoo/models.py b/odoo/models.py index 329e64bca7c..ae4d6590148 100644 --- a/odoo/models.py +++ b/odoo/models.py @@ -4719,7 +4719,7 @@ Fields: return cls._transient @api.model - def search_read(self, domain=None, fields=None, offset=0, limit=None, order=None): + def search_read(self, domain=None, fields=None, offset=0, limit=None, order=None, **read_kwargs): """Perform a :meth:`search` followed by a :meth:`read`. :param domain: Search domain, see ``args`` parameter in :meth:`search`. @@ -4732,6 +4732,8 @@ Fields: Defaults to no limit. :param order: Columns to sort result, see ``order`` parameter in :meth:`search`. Defaults to no sort. + :param read_kwargs: All read keywords arguments used to call read(..., **read_kwargs) method + E.g. you can use search_read(..., load='') in order to avoid computing name_get :return: List of dictionaries containing the asked fields. :rtype: list(dict). """ @@ -4752,7 +4754,7 @@ Fields: del context['active_test'] records = records.with_context(context) - result = records.read(fields) + result = records.read(fields, **read_kwargs) if len(result) <= 1: return result