mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
[IMP] web_responsive: Redirect to home after login
Redirect to the home page after login will occur only if the user has enabled the 'Redirect to Home' configuration in their user profile settings
This commit is contained in:
@@ -2,3 +2,4 @@
|
||||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
|
||||
|
||||
from . import test_ir_http
|
||||
from . import test_res_users
|
||||
|
||||
32
web_responsive/tests/test_res_users.py
Normal file
32
web_responsive/tests/test_res_users.py
Normal file
@@ -0,0 +1,32 @@
|
||||
# Copyright 2023 Taras Shabaranskyi
|
||||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
|
||||
|
||||
from odoo.tests.common import TransactionCase
|
||||
|
||||
|
||||
class TestResUsers(TransactionCase):
|
||||
def test_compute_redirect_home(self):
|
||||
record = self.env["res.users"].create(
|
||||
{
|
||||
"action_id": False,
|
||||
"is_redirect_home": False,
|
||||
"name": "Jeant",
|
||||
"login": "jeant@mail.com",
|
||||
"password": "jeant@mail.com",
|
||||
}
|
||||
)
|
||||
|
||||
record._compute_redirect_home()
|
||||
self.assertFalse(record.is_redirect_home)
|
||||
|
||||
action_obj = self.env["ir.actions.actions"]
|
||||
record.action_id = action_obj.create(
|
||||
{"name": "Test Action", "type": "ir.actions.act_window"}
|
||||
)
|
||||
record._compute_redirect_home()
|
||||
self.assertFalse(record.is_redirect_home)
|
||||
|
||||
record.action_id = False
|
||||
record.is_redirect_home = True
|
||||
record._compute_redirect_home()
|
||||
self.assertTrue(record.is_redirect_home)
|
||||
Reference in New Issue
Block a user