[FIX] web_tour: add sudo for record creation

Method `consume` is called at the end of a tour. Tour can be started via debug
menu by any admin with "Access rights", however the method requires `Settings`
access level.

Fix it by adding `sudo()`. This issue could be reviewed in master.

STEPS:

* change Administration access level to "Access rights"
* start tour `sale_quote_tour`
* follow the tour steps

opw-2965772

closes odoo/odoo#103801

X-original-commit: c96111bf1cc7611b3b3e0b9f210d50cff527cc91
Signed-off-by: Ivan Elizaryev (iel) <iel@odoo.com>
This commit is contained in:
Ivan Yelizariev
2022-10-24 10:54:23 +02:00
parent 572027ab47
commit 5779e29f35
+5 -1
View File
@@ -17,8 +17,12 @@ class Tour(models.Model):
def consume(self, tour_names):
""" Sets given tours as consumed, meaning that
these tours won't be active anymore for that user """
if not self.env.user.has_group('base.group_user'):
# Only internal users can use this method.
# TODO master: update ir.model.access records instead of using sudo()
return
for name in tour_names:
self.create({'name': name, 'user_id': self.env.uid})
self.sudo().create({'name': name, 'user_id': self.env.uid})
@api.model
def get_consumed_tours(self):