Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
3238 Lượt xem

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

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

you can assign directly this way 

    tag_ids = tags_to_add.ids

or 

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


Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 4 25
3424
0
thg 3 24
1283
1
thg 2 24
1962
0
thg 7 24
3010
0
thg 10 22
2455