๐๐๐ ๐๐๐ญ๐ก๐จ๐๐ฌ : ๐๐๐๐ซ๐๐ก()
The search() Method allows you to find records that match specific criteria.
It enables you to search for records in a model based on a particular domain.
Parameters:
domain: a list of tuples that define the criteria that the records must match. Use an empty list to match all records.
offset: number of results to ignore.
limit: maximum number of records to return.
order: A sort string, which specifies how the results should be sorted and returned.
Returns:
list of records that satisfy the given domain.
Raises AccessError: if user is not allowed to access requested information
Example
partners = self.env['res.partner'].search([('name', 'like', 'Mohamed')],limit=3, offset=1, order='date asc')
You can also specify multiple fields in the order string, like below:
order="name asc, date desc"
raise AccessError ?
It occurs when a user tries to perform an operation that they are not authorized to perform, such as when the user does not have the appropriate permissions for the model or record.
Example
Subscribe to my newsletter
Read articles from amr gaber directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
amr gaber
amr gaber
Hey! I'm Amr, a software engineer who is passionate about all things open source. I enjoy coding using Python.