๐Ž๐‘๐Œ ๐Œ๐ž๐ญ๐ก๐จ๐๐ฌ : ๐’๐ž๐š๐ซ๐œ๐ก()

Search Made Easy: A Guide to the search() Method

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:

  1. domain: a list of tuples that define the criteria that the records must match. Use an empty list to match all records.

  2. offset: number of results to ignore.

  3. limit: maximum number of records to return.

  4. 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

ย