Community mailing list archives

Re: cache gone with sudo()

Holger Brunn
- 05/18/2016 04:20:34
> I want to fetch some fields from related field, for example:
> |record.new_field = record.relation1_id.this_field|, since the model for
> |relation1_id| have some other relation fields that have no security
> access for the current user.

just some relation field that's not accessible on the record shouldn't
prevent you from accessing other ones, so if it's only that, you don't
need sudo at all.

If you need to go through some chain where you indeed don't have access
with the current user, say compute_sudo=True on the field definition, or
do something like

record.new_field = self.env['new.field.model'].browse(

Therp - Maatwerk in open ontwikkeling

Holger Brunn - Ontwerp en implementatie

phone: +31 (0)20 3093096