Se rendre au contenu
Menu
Cette question a été signalée
1 Répondre
3263 Vues

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
Ignorer
Meilleure réponse

you can assign directly this way 

    tag_ids = tags_to_add.ids

or 

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


Avatar
Ignorer
Publications associées Réponses Vues Activité
1
avr. 25
3450
0
mars 24
1286
1
févr. 24
1997
0
juil. 24
3029
0
oct. 22
2473