top of page

Odoo - Bypass record rule in the python codes

  • Writer: Tek Siong, Hock
    Tek Siong, Hock
  • Jan 8, 2023
  • 1 min read

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)



 
 
 

Recent Posts

See All
Odoo Performance Profile for debugging

Odoo Performance Profile for debugging, If you are on Odoo 16 and below, and need a good tool for debugging the performance of your Odoo system, this will be the right content for you.

 
 
 

Comments


Subscribe Form

  • facebook
  • linkedin

©2019 by Excelroot Technology Sdn Bhd.

bottom of page