تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
2476 أدوات العرض

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))]

الصورة الرمزية
إهمال
أفضل إجابة

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).

الصورة الرمزية
إهمال
أفضل إجابة

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

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
2
يوليو 25
1949
0
مارس 25
1044
1
يوليو 24
1924
7
يوليو 24
25116
2
أبريل 24
3304