Odoo 10-搜索条件

Odoo 10-搜索条件,odoo,odoo-10,Odoo,Odoo 10,我正在尝试根据以下条件进行搜索: .search([("product_id", "=", int(product_id)), ("language", "=", language), ['|', ("type", "=", "data"), ("type", "=", "translation")], ]) 它基本上在给定模型(它是一个自定义模型)中搜索: 给定的产品id和 给定的语言和 类型列是的“数据”或的“翻译” 但我得到: File "/usr/lib/python2.ion = d

我正在尝试根据以下条件进行搜索:

.search([("product_id", "=", int(product_id)), ("language", "=", language), ['|', ("type", "=", "data"), ("type", "=", "translation")], ])
它基本上在给定模型(它是一个自定义模型)中搜索:

  • 给定的
    产品id
  • 给定的
    语言
  • 类型
    列是
    的“数据”
    的“翻译”
  • 但我得到:

    File "/usr/lib/python2.ion = distribute_not(normalize_domain(domain))\n  
    File "/usr/lib/python2.7/dist-packages/odoo/osv/ex
    GATION:\nTypeError: unhashable type: \'list\'\n'>
    

    搜索
    条件定义是否正确?

    您定义搜索条件的方式不正确

    试试这个


    .search(['|',(“type”,“=”,“data”),(“type”,“=”,“translation”),(“product\u id”,“=”,int(product\u id)),(“language”,“=”,language)],
    您定义搜索条件的方式不正确

    试试这个

    .search(['|]、(“type”、“=”、“data”)、(“type”、“=”、“translation”)、(“product\u id”、“=”、int(product\u id))、(“language”、“=”、language)])
    根据,“和”(默认值)和“!”是两个算术,因此您可以这样做:

    [("product_id", "=", int(product_id)),("language", "=", language),
    '|', ("type", "=", "data"), ("type", "=", "translation")]
    
    根据“&”(默认)和“!”是两个算术,因此您可以这样做:

    [("product_id", "=", int(product_id)),("language", "=", language),
    '|', ("type", "=", "data"), ("type", "=", "translation")]
    

    那不是
    一切吗?那不是
    一切吗?