Altering the Environment
with_context([context][, **overrides]) → records.
This method generates a new recordset with an additional context.
Eg:
# current context is {'key1': True}
result1 = records.with_context({}, key2=True)
# result1._context is {'key2': True}
result2 = records.with_context(key2=True)
# result2._context is {'key1': True, 'key2': True}
with_user(user)
If the user is not the superuser, return a new version of this recordset connected to the specified in non-superuser mode.
with_company(company)
Return a new instance of this recordset with altered context, such that:
result.env.company = company
result.env.companies = self.env.companies | company
Parameters:
company (res_company or int) – The primary company in the new environment.
If a current user is using an unauthorized company, accessing the company(ies) on the environment may result in an AccessError if not done in a sudoed environment.
with_env(env)
Return a new version of this recordset that is bound to the environment provided.
Parameters:
env (Environment)
sudo([flag=True])
Depending on the flag, returns a new version of this recordset with superuser mode enabled or disabled. The superuser mode has no effect on the current user and simply bypasses access rights checks.