Reputation: 5495
I am trying to search based on the following condition:
.search([("product_id", "=", int(product_id)), ("language", "=", language), ['|', ("type", "=", "data"), ("type", "=", "translation")], ])
Which basically searchs in a given model (it is a custom one) for:
product_id
ANDlanguage
ANDtype
column being either "data"
OR "translation"
But I get:
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'>
Is the search
condition properly defined?
Upvotes: 0
Views: 459
Reputation: 65
According to documentation, "&" (default) and "!" are 2 arity, so you can do like this:
[("product_id", "=", int(product_id)),("language", "=", language),
'|', ("type", "=", "data"), ("type", "=", "translation")]
Upvotes: 2
Reputation: 46
The way you have defined the search condition is incorrect.
Try this instead
.search(['|', ("type", "=", "data"), ("type", "=", "translation"), ("product_id", "=", int(product_id)), ("language", "=", language)])
Upvotes: 2