summaryrefslogtreecommitdiff
path: root/odoo/fields.py
diff options
context:
space:
mode:
authorRaphael Collet <rco@odoo.com>2019-05-31 09:54:23 +0000
committerRaphael Collet <rco@odoo.com>2019-07-04 09:24:23 +0000
commit1e6c3bec2c5ca621344b09e58dbed535e80fb343 (patch)
treeaa570f410f4121d102cd4b5c3d363a9aa21b40e4 /odoo/fields.py
parent541012c9ea7548190eb93d3534bae32d16d76ae8 (diff)
[ADD] api: flag `su` on environments
The flag defines a "superuser mode" on environments, which allows to bypass access rights without changing the current user id.
Diffstat (limited to 'odoo/fields.py')
-rw-r--r--odoo/fields.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/odoo/fields.py b/odoo/fields.py
index db856b646e4..5a146f6664d 100644
--- a/odoo/fields.py
+++ b/odoo/fields.py
@@ -659,7 +659,7 @@ class Field(MetaField('DummyField', (object,), {})):
if 'force_company' not in context:
company = records.env.company
context = dict(context, force_company=company.id)
- Property = records.env(user=SUPERUSER_ID, context=context)['ir.property']
+ Property = records.env(context=context, su=True)['ir.property']
values = Property.get_multi(self.name, self.model_name, records.ids)
for record in records:
record[self.name] = values.get(record.id)
@@ -670,7 +670,7 @@ class Field(MetaField('DummyField', (object,), {})):
if 'force_company' not in context:
company = records.env.company
context = dict(context, force_company=company.id)
- Property = records.env(user=SUPERUSER_ID, context=context)['ir.property']
+ Property = records.env(context=context, su=True)['ir.property']
values = {
record.id: self.convert_to_write(record[self.name], record)
for record in records
@@ -2929,6 +2929,5 @@ def prefetch_value_ids(record, field):
# imported here to avoid dependency cycle issues
-from odoo import SUPERUSER_ID
from .exceptions import AccessError, MissingError, UserError
from .models import check_pg_name, BaseModel, NewId, IdType