Odoo14 ir.rule 中的domain查询语句

# ir.rule 中的domain查询语句
# 当你的字段是many2one、many2many、one2many的时候domain都会强制加上过滤域
# tree显示的时候也会过滤
# m.model:模块名
# gu.uid:res_users.id
# r.perm_read:读,还有r.perm_write、r.perm_delete、r.perm_create
SELECT * FROM ir_rule r JOIN ir_model m ON (r.model_id=m.id)
                    WHERE m.model='res.company' AND r.active AND r.perm_read
                    AND (r.id IN (SELECT rule_group_id FROM rule_group_rel rg
                                  JOIN res_groups_users_rel gu ON (rg.group_id=gu.gid)
                                  WHERE gu.uid=2)

 

posted @ 2021-12-28 17:05  看一百次夜空里的深蓝  阅读(219)  评论(0编辑  收藏  举报