Odoo - Bypass record rule in the python codes
top of page
  • Writer's pictureTek Siong, Hock

Odoo - Bypass record rule in the python codes

What are the occasions when you need to bypass the record rule?

a) Certain fields are only accessible by certain group of users (record rule) and if the restricted field value are updated by all users action.


b) User's action will trigger the retrieving of data by search that may have the record rules that are restricted to the user.


The solution is simple by using sudo().

Eg,

self.env['account.invoice'].sudo().search(invoice_domain)



12 views0 comments

Recent Posts

See All

Odoo Element Cannot be Located in Parent View

Sometimes, after you've added a new field to the existing view, by inheriting the view, you may encountered the following error, when upgrading the module. Element 'XXXXX' cannot be located in parent

bottom of page