This commit fixes a traceback when trying to install demo data from the UI.
Steps to reproduce:
- create a database with website_event_track_live installed and without demo data
- load demo data from the UI (settings)
- odoo.exceptions.AccessError: You are not allowed to create 'Website Visitor'
(website.visitor) records.
There is a traceback because the installer can't create `website_visitor`
records because there are no groups that have create access rights for that
model.
This is because xml_import used to get an environment with root privileges, that
can bypass access rights, but now the environment is a parameter passed to the
function and doesn't necessarily have sudo
This change was introduced in
5bf1207#diff-8e4705d5ab335a8dfc2c70eeedc502a92695989f97c4f19184b49634c2c4ad55L583-R583
; with this commit, the environment used by xml_import doesn't necessarily have
sudo, so we simply make sure `load_demo` loads data with sudo.
Task-3202914
closesodoo/odoo#129946
X-original-commit: 85834371e0eede05858cb2dc33412396c6e5c5bf
Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
Signed-off-by: Adrien Milis (miad) <miad@odoo.com>