コンテンツへスキップ
メニュー
この質問にフラグが付けられました
2 返信
3043 ビュー

liste_etudiant = []
for record in self:
if record.x_studio_anne_academique_:
etudiant = self.env['x_apprenant_par_annee'].search([('x_studio_many2one_field_S5CZy.id','=',record.x_studio_anne_academique_.id)])
if etudiant:
for line in etudiant:

liste_etudiant.append(line)

---------------------------------------------------------------------------------------------------

Now my data is in liste_etudiant.

The issue, is how put this data in many2manyfield ?

when i do this :

for f in liste_etudiant:
record.write({' x_studio_many2many_field_knpV7' : f})

I only get one data display in many2many field.

Thanks !

アバター
破棄
最善の回答

Try the below code:

for record in self:
liste_etudiant = []
if record.x_studio_anne_academique_:
etudiant = self.env['x_apprenant_par_annee'].search(
[('x_studio_many2one_field_S5CZy.id', '=', record.x_studio_anne_academique_.id)])
if etudiant:
for line in etudiant:
liste_etudiant.append(line.id)
if liste_etudiant:
record.write({'x_studio_many2many_field_knpV7': [(6, 0, liste_etudiant)]})
アバター
破棄
著作者

Thanks very much! it's worked.

please, in addition can u explain me action = {} used in automate actions. And how to use it , give me some example of code.

Am very grateful !

最善の回答

hii, I need do similar function, Waleed Ali Mohsen. Please, help me. 

At 6 hours I'll be in office and I'll contact to u


アバター
破棄
関連投稿 返信 ビュー 活動
1
6月 25
15371
3
4月 25
5548
2
7月 24
2560
1
2月 24
2027
1
1月 24
1817