Pular para o conteúdo
Menu
Esta pergunta foi sinalizada
1 Responder
3256 Visualizações

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

Avatar
Cancelar
Melhor resposta

you can assign directly this way 

    tag_ids = tags_to_add.ids

or 

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


Avatar
Cancelar
Publicações relacionadas Respostas Visualizações Atividade
1
abr. 25
3439
0
mar. 24
1285
1
fev. 24
1966
0
jul. 24
3015
0
out. 22
2465