[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:
Sébastien Theys
2018-08-24 15:55:46 +02:00
parent b8c6c24bbb
commit 1addade28b
2 changed files with 4 additions and 2 deletions
+2
View File
@@ -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):
"""
+2 -2
View File
@@ -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'):