Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
5075 Lượt xem

Hello,


I am working with a piece of JS code which states:

    if (session.is_system) {

From what I can gather this only returns True when they have admin rights to settings.


I would like it to only run when they are an internal user. 


In Python it would be something like this:

    user.has_group('base.group_user'):

How would I replicate this in Odoo?


Thanks, 


  

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

you can use something like


const session = require('web.session');
......
......
const isInternaluser = await session.user_has_group('base.group_user');
if ( isInternaluser) { ... }
Ảnh đại diện
Huỷ bỏ
Tác giả

Hello Ravi, thank you for the code! Just to confirm, is "is_system" only have settings to admin access rights?

is_system is a superuser, it has all the access rights.

which odoo version are you using?

some business login has been changed related to superuser in V13

Tác giả

Hello Ravi, I am on Version 13 Enterprise Odoo.sh

For some reason, this condition is implemented in Javascript when it should be available for all users not just Admin.

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 5 25
8257
1
thg 11 24
4950
0
thg 5 24
2110
1
thg 4 24
2058
1
thg 2 24
2770