域中的多个条件不起作用 - OpenERP 7 - Odoo

Multiple condition in domain is not working - OpenERP 7 - Odoo

我正在尝试为我的域使用多个条件,但出现此错误:

ValueError: 无效叶 ('&', ('A', '=', True), ('B', '=', False)

我不知道为什么。一切看起来都很好。我想要 (A & !B) 或 (C & !D)

这是我的代码(OpenERP 7):

        <field name="domain">['|',('&amp;',('A','=', True),('B','=', False)),('&amp;',('C','!=', True),('D','=', False))]</field>

我的代码有什么问题?有什么想法吗?

您使用了额外的括号。前缀表示法(又名波兰表示法)是关于丢弃括号的必要性。你应该使用正确的 "prefix notation" in condition statement. In order to correct a syntax, we have to remove extra brackets, so the above posted condition becomes ['|','&amp;',('A','=', True),('B','=', False),'&amp;',('C','!=', True),('D','=', False)]. It'll solve the Invalid leaf error. See also my answer to the similar question.