mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
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
33 lines
1.0 KiB
Python
33 lines
1.0 KiB
Python
# 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)
|