[FIX] website_portal: allow non employee user to log in to the portal

Commit #3649b7f359b640635cbe0bc4f161884ba64c2318 remove sudo when loading the menu.

Add test to check that homepage portal can be loaded with user portal.
That's the first test using portal user, it don't really test the portal features,
but just that the loading of portal homeapge works...
This commit is contained in:
Jeremy Kersten
2017-02-01 09:05:44 +01:00
parent 371bcc6993
commit 3d0cc2d6d2
5 changed files with 43 additions and 1 deletions
@@ -0,0 +1,24 @@
odoo.define('website_portal.tour', function (require) {
'use strict';
var tour = require("web_tour.tour");
var base = require("web_editor.base");
tour.register('portal_load_homepage', {
test: true,
url: '/my',
wait_for: base.ready()
},
[
{
content: "Check portal is loaded",
trigger: 'a[href*="/my/account"]:contains("Change"):first',
},
{
content: "Load my account details",
trigger: 'body:contains("Contact Details")',
}
]
);
});
+1
View File
@@ -0,0 +1 @@
import test_load_process
@@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import odoo.tests
@odoo.tests.common.at_install(False)
@odoo.tests.common.post_install(True)
class TestUi(odoo.tests.HttpCase):
def test_01_portal_load_tour(self):
self.phantom_js(
"/",
"odoo.__DEBUG__.services['web_tour.tour'].run('portal_load_homepage')",
"",
login="portal"
)
@@ -5,6 +5,7 @@
<xpath expr="." position="inside">
<link rel='stylesheet' href='/website_portal/static/src/less/website_portal.less'/>
<script type="text/javascript" src="/website_portal/static/src/js/website_portal.js"></script>
<script type="text/javascript" src="/website_portal/static/src/js/website_portal_tour.js"></script>
</xpath>
</template>
+1 -1
View File
@@ -102,7 +102,7 @@ class IrUiMenu(models.Model):
'ir.actions.report.xml': lambda action: action.model,
'ir.actions.server': lambda action: action.model_id.model,
}
for menu in action_menus:
for menu in action_menus.sudo():
get_model = MODEL_GETTER.get(menu.action._name)
if not get_model or not get_model(menu.action) or \
access.check(get_model(menu.action), 'read', False):