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

I have one model with 2 one2many relations (mat_gen and rh_gen). The first relation has a field named "qte", i want to update the second one when the "qte" changes with an onchange method.

@api.onchange('qte')

def onchange_qte(self):

mat = self.browse(self._origin.id)

if mat:

mo = self.env["plg.ressource.rh"].browse(mat.ch.id)

if mo:

temp = []

temp.append({ 'code': mo.code, 'designation': mo.designation, 'unite': mo.unite.id, 'qte': self.qte, 'aff_pr': self.aff_pr, 'prixu': mo.prixu, })

Here i've to access the parent model to update the second relation like self.parent.update({'rh_gen':temp}) but obviously the parent variable does not exist. How can i fix this?

Thanks in advance

아바타
취소
베스트 답변

Check this link

https://www.odoo.com/groups/technical-62/community-framework-23766083?mode=thread

아바타
취소
베스트 답변

hello..!
you can also update by calling write method
try this once self.parent.write({'rh_gen':temp}) 

아바타
취소
관련 게시물 답글 화면 활동
1
4월 25
3931
3
12월 22
11867
5
4월 24
42493
6
4월 24
39402
3
3월 24
10893