İçereği Atla
Menü
Bu soru işaretlendi
1 Cevapla
6054 Görünümler

Hi,


I'm trying to make the following call from js tor retrieve a list of object from a list of ids, but I can't make the filter work. I don't know how to make an 'OR' statement. I tried to use '|' as an operator but I get an error

TypeError: unhashable type: 'list


self._rpc({
model: self.modelName,
method: 'search_read',
context: self.data.context,
fields: self.fieldNames,
domain: [
            ['|', ['id', '=', 1'], ['id', '=', 2], ['id', '=', 3]]
]
})


Regards



Avatar
Vazgeç
En İyi Yanıt

Hi ALBRAHMS

You have an extra []. Try it like this

self._rpc({
model: self.modelName,
method: 'search_read',
context: self.data.context,
fields: self.fieldNames,
domain: [
            '|', ['id', '=', 1'], ['id', '=', 2], ['id', '=', 3]
]
})

Always It's better with an example from Odoo itself

https://github.com/odoo/odoo/blob/d3147910e031253ddb172959e9016a0f326d7cdb/addons/web/static/src/js/views/kanban/kanban_record.js#L387-L395

Avatar
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
0
Haz 22
4005
2
Oca 23
4856
0
Şub 21
3188
5
Eyl 20
12330
2
Mar 15
8395