Files
web/web_responsive/tests/test_res_users.py
Angel Patel c7d59e83b8 [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
2024-07-17 16:07:24 +05:30

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)