Odoo记录规则限制

Odoo record rule restrictions

我想要发生的事情:

当布尔值 no_edit 为 False 且 user_id 为 false 或当前用户时,用户应该可以编辑记录。

实际发生了什么:

记录始终限制编辑。

Python 字段代码:

user_id = fields.Many2one(
        comodel_name = 'res.users',
        string = 'User ID',
        readonly = True,
    )
no_edit = fields.Boolean(
        string = "No Edit",
        copy = False,
        default = False
    )

域:

['&', '|', ('no_edit', '=', False), ('user_id', '=', False), ('user_id', '=', user.id)]

提前致谢

域应该是:

[('no_edit', '=', False), '|', ('user_id', '=', False), ('user_id', '=', user.id)]

您所做的将第一部分评估为 & 运算符:

('user_id', '=', False) & ('user_id', '=', user.id)

因为是用"Reverse Polish Notation"求值的,更多信息可以搜索或输入这个link:

https://en.wikipedia.org/wiki/Reverse_Polish_notation