Ir al contenido
Menú
Se marcó esta pregunta
2 Respuestas
2473 Vistas

Hi. I'm trying to import slack channels into odoo but the above mentioned error arises. I am trying to populate a many2many field. I tried to pass tuple into it but got no luck. If anyone has any suggestions,do reply. While debugging, I realized that the error occurs when the ORM methods like write or create gets triggered.
Following is my line of code which I believe is the reason behind this error:

'channel_partner_ids': [(6, 0, tuple(total_partner_ids))]

Avatar
Descartar
Mejor respuesta

Hello Syed

In python, lists are unhashable types. Tuples are indeed hashable.

Please check the docs regarding "magic" field Commands. It's likely that the values you're using don't exist yet and so you need to CREATE them (magic value 0) and not SET them (magic value 6).

Avatar
Descartar
Mejor respuesta

Hi,

In Odoo, when you encounter the "unhashable type: 'list'" error in the context of a Many2many field, it could be due to how you are trying to create or update the Many2many field.The Many2many field expects a record set or a list of record IDs, and not a list of dictionaries directly.channel_partner_ids': [(6, 0, total_partner_ids.ids)]



Hope it helps

Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
2
jul 25
1937
0
mar 25
1032
1
jul 24
1915
7
jul 24
25095
2
abr 24
3298