Merge PR #2978 into 17.0

Signed-off-by pedrobaeza
pull/2986/head
OCA-git-bot 2024-11-04 16:35:37 +00:00
commit 96cb5d5d91
1 changed files with 10 additions and 19 deletions

View File

@ -1,32 +1,23 @@
# Copyright 2023 Taras Shabaranskyi # Copyright 2023 Taras Shabaranskyi
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
from odoo.tests import new_test_user
from odoo.tests.common import TransactionCase from odoo.addons.base.tests.common import BaseCommon
class TestResUsers(TransactionCase): class TestResUsers(BaseCommon):
def test_compute_redirect_home(self): def test_compute_redirect_home(self):
record = self.env["res.users"].create( record = new_test_user(self.env, login="jeant@mail.com")
self.assertFalse(record.is_redirect_home)
action = self.env["ir.actions.act_window"].create(
{ {
"action_id": False, "name": "Test Action",
"is_redirect_home": False, "type": "ir.actions.act_window",
"name": "Jeant", "res_model": record._name,
"login": "jeant@mail.com",
"password": "jeant@mail.com",
} }
) )
record.action_id = action.id
record._compute_redirect_home()
self.assertFalse(record.is_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.action_id = False
record.is_redirect_home = True record.is_redirect_home = True
record._compute_redirect_home()
self.assertTrue(record.is_redirect_home) self.assertTrue(record.is_redirect_home)