summaryrefslogtreecommitdiff
path: root/addons/account/models/res_users.py
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2019-09-24 16:59:15 +0000
committerChristophe Simonis <chs@odoo.com>2019-09-24 17:45:37 +0000
commitd67b2483e5bfa5d8c1e6ef1a64fb933f5e080ad5 (patch)
tree25a7fd39ac993f3c04c5d8408beb628b3c9948ce /addons/account/models/res_users.py
parent38d8b0526f0fccc32df5a11f5d086a3522ed5fcf (diff)
parent9ed4872ea03f28012118ed48a43d0800617a84f3 (diff)
[MERGE] forward port branch saas-12.4 up to 9ed4872ea03
closes odoo/odoo#37372 Signed-off-by: Christophe Simonis <chs@odoo.com>
Diffstat (limited to 'addons/account/models/res_users.py')
-rw-r--r--addons/account/models/res_users.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/addons/account/models/res_users.py b/addons/account/models/res_users.py
index 6b379668fa3..d564746dfd6 100644
--- a/addons/account/models/res_users.py
+++ b/addons/account/models/res_users.py
@@ -12,8 +12,12 @@ class Users(models.Model):
def _check_one_user_type(self):
super(Users, self)._check_one_user_type()
- g1 = self.env.ref('account.group_show_line_subtotals_tax_included')
- g2 = self.env.ref('account.group_show_line_subtotals_tax_excluded')
+ g1 = self.env.ref('account.group_show_line_subtotals_tax_included', False)
+ g2 = self.env.ref('account.group_show_line_subtotals_tax_excluded', False)
+
+ if not g1 or not g2:
+ # A user cannot be in a non-existant group
+ return
if self._has_multiple_groups([g1.id, g2.id]):
raise ValidationError(_("A user cannot have both Tax B2B and Tax B2C.\n"