From 728ceccca135c9ec9d65c60977fa8889c41ac0a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Warnon?= Date: Mon, 8 May 2023 14:24:10 +0000 Subject: [PATCH] [IMP] base: introduce "_is_portal" on res.users This commit introduces a "_is_portal" method complementary to the existing "_is_internal" and "_is_public". The goal is to ease usage through the code base and be able to easily distinguish our 3 main use cases: public, portal and internal users. Task-3056280 closes odoo/odoo#120827 Related: odoo/enterprise#38575 Related: odoo/upgrade#4575 Signed-off-by: Thibault Delavallee (tde) --- odoo/addons/base/models/res_users.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/odoo/addons/base/models/res_users.py b/odoo/addons/base/models/res_users.py index a9804cf53fc..e5f8b0b7495 100644 --- a/odoo/addons/base/models/res_users.py +++ b/odoo/addons/base/models/res_users.py @@ -1031,6 +1031,10 @@ class Users(models.Model): self.ensure_one() return not self.sudo().share + def _is_portal(self): + self.ensure_one() + return self.has_group('base.group_portal') + def _is_public(self): self.ensure_one() return self.has_group('base.group_public')