summaryrefslogtreecommitdiff
path: root/odoo/api.py
diff options
context:
space:
mode:
authorRaphael Collet <rco@odoo.com>2019-06-17 14:29:51 +0000
committerRaphael Collet <rco@odoo.com>2019-07-04 11:32:22 +0000
commit368e9530f4e6366bffa9d1289ed064bc954f8531 (patch)
tree50162953e1adb331cb3852fd38da2631f2ece966 /odoo/api.py
parentb7fd679a6c41dbb694c6fb2ce4911798de0424b1 (diff)
[REF] *: `record.env.user._is_XXX()` -> `record.env.is_XXX()`
Superuser mode implies `record.env.is_XXX()`.
Diffstat (limited to 'odoo/api.py')
-rw-r--r--odoo/api.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/odoo/api.py b/odoo/api.py
index e0358bba202..a08a12e297a 100644
--- a/odoo/api.py
+++ b/odoo/api.py
@@ -855,6 +855,20 @@ class Environment(Mapping):
""" return the record corresponding to the given ``xml_id`` """
return self['ir.model.data'].xmlid_to_object(xml_id, raise_if_not_found=raise_if_not_found)
+ def is_superuser(self):
+ """ Return whether the environment is in superuser mode. """
+ return self.su
+
+ def is_admin(self):
+ """ Return whether the current user has group "Access Rights", or is in
+ superuser mode. """
+ return self.su or self.user._is_admin()
+
+ def is_system(self):
+ """ Return whether the current user has group "Settings", or is in
+ superuser mode. """
+ return self.su or self.user._is_system()
+
@property
def user(self):
""" return the current user (as an instance) """