Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
3265 มุมมอง

Hello everyone,

I am using Odoo12 and have the need to add several values to tag_ids which is a many2many field type on the account.account model on write method.

I have a list of tag_ids I need to add:

Sample code:

list = [1, 2, 3, 4]
tags_to_add = self.env['account.account.tag'].search([('id', 'in', list)])

How can I add those values in "tags_to_add" to the tags_id field on write method?

Thank you very much in advance

PM

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

you can assign directly this way 

    tag_ids = tags_to_add.ids

or 

    tag_ids = [(6,0, tags_to_add.ids )]
    


อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
เม.ย. 25
3451
0
มี.ค. 24
1287
1
ก.พ. 24
1998
0
ก.ค. 24
3031
0
ต.ค. 22
2473