[FIX] base: correctly detect when admin logs in
Since 2f7c03d9ca it's not possible to log in as user 1.
However, we reset the base url when the admin logs in, which is now user 2.
This fixes wkhtml2pdf was not able to load css file, and probably some other side effects.
PR: none
Task: 1879620
This commit is contained in:
@@ -63,6 +63,8 @@ if hasattr(time, 'tzset'):
|
||||
#----------------------------------------------------------
|
||||
# The hard-coded super-user id (a.k.a. administrator, or root user).
|
||||
SUPERUSER_ID = 1
|
||||
ADMINUSER_ID = 2
|
||||
|
||||
|
||||
def registry(database_name=None):
|
||||
"""
|
||||
|
||||
@@ -16,7 +16,7 @@ from lxml import etree
|
||||
from lxml.builder import E
|
||||
import passlib.context
|
||||
|
||||
from odoo import api, fields, models, tools, SUPERUSER_ID, _
|
||||
from odoo import api, fields, models, tools, SUPERUSER_ID, ADMINUSER_ID, _
|
||||
from odoo.exceptions import AccessDenied, AccessError, UserError, ValidationError
|
||||
from odoo.http import request
|
||||
from odoo.osv import expression
|
||||
@@ -584,7 +584,7 @@ class Users(models.Model):
|
||||
relevant environment attributes
|
||||
"""
|
||||
uid = cls._login(db, login, password)
|
||||
if uid == SUPERUSER_ID:
|
||||
if uid == ADMINUSER_ID:
|
||||
# Successfully logged in as admin!
|
||||
# Attempt to guess the web base url...
|
||||
if user_agent_env and user_agent_env.get('base_location'):
|
||||
|
||||
Reference in New Issue
Block a user