【问题标题】:How can I check if a user is Manager for a specific module in Odoo?如何检查用户是否是 Odoo 中特定模块的经理?
【发布时间】:2015-05-07 09:57:41
【问题描述】:

我正在寻找一种方法来检查登录用户是否是“销售点”等特定模块的经理。使用 SQL 我可以检查这个条件,但是我们可以使用 ORM 来完成同样的事情吗?

以下是我的 sql 查询,它列出了“销售点”模块的经理用户:在 ORM 中寻找相同的等效项或其他方式来完成所需的事情:

select login, usr.id as user_id, grp.id group_id, grp.name, cat.name 
from res_users usr, res_groups_users_rel rel, res_groups grp, ir_module_category cat
where usr.id = rel.uid
and rel.gid = grp.id
and grp.category_id = cat.id
and cat.name = 'Point of Sale'
and grp.name = 'Manager'; 

【问题讨论】:

    标签: orm xml-rpc odoo


    【解决方案1】:

    终于完成了:) 以下是我在 python 中的工作代码:

    models.execute_kw(db, uid, password,
        'res.users', 'search',[[['id','=',userid],['groups_id.name','=','Manager'],['groups_id.category_id.name','=','Point of Sale']]],{})
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-06-05
      • 2020-11-29
      • 2020-08-13
      • 2013-04-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多