콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
2 답글
3041 화면

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
15370
3
4월 25
5548
Compute Fields 해결 완료
2
7월 24
2559
1
2월 24
2027
1
1월 24
1817