[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:
Angel Patel
2024-06-28 12:19:28 +05:30
parent 618d6740e8
commit c7d59e83b8
10 changed files with 178 additions and 40 deletions

View File

@@ -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

View 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)