跳至内容
菜单
此问题已终结
1 回复
3235 查看

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


形象
丢弃
相关帖文 回复 查看 活动
1
4月 25
3424
0
3月 24
1283
1
2月 24
1962
0
7月 24
3009
0
10月 22
2455