[FIX] web_unsplash, website: fix deps between website and web_unsplash

Website has no dependency to web_unsplash, we cannot warranty the order
of the execution of the overwrite done in 5ef8300.
So to avoid to create a new module bridge, with a lot of code, we prefer
to make a check for website user directly in unsplash module.
It is 'safe' since if you don't have website, the group
`group_website_designer` doesn't exists and so it will do a `or False`.

closes odoo/odoo#93885

X-original-commit: 05f9f5db372b1a3644f85cb1de3c443b722ef309
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
This commit is contained in:
Jeremy Kersten
2022-06-17 14:14:38 +02:00
parent 4d41afd0ef
commit 6ee8ee2183
2 changed files with 6 additions and 8 deletions
+6 -2
View File
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, models
from odoo import models
class ResUsers(models.Model):
@@ -8,4 +8,8 @@ class ResUsers(models.Model):
def _has_unsplash_key_rights(self):
self.ensure_one()
return self.has_group('base.group_erp_manager')
# Website has no dependency to web_unsplash, we cannot warranty the order of the execution
# of the overwrite done in 5ef8300.
# So to avoid to create a new module bridge, with a lot of code, we prefer to make a check
# here for website's user.
return self.has_group('base.group_erp_manager') or self.has_group('website.group_website_designer')
-6
View File
@@ -19,12 +19,6 @@ class ResUsers(models.Model):
('login_key', 'unique (login, website_id)', 'You can not have two users with the same login!'),
]
def _has_unsplash_key_rights(self):
self.ensure_one()
if self.has_group('website.group_website_designer'):
return True
return super(ResUsers, self)._has_unsplash_key_rights()
@api.constrains('login', 'website_id')
def _check_login(self):
""" Do not allow two users with the same login without website """