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

How to add onchange event with Save, Create or Edite Buttons (these are default button within a form)?

아바타
취소
베스트 답변

You can try to override the create/write methods and call the onchange methods.

Ex:

@api.model
def create(self, vals):
res = super(...).create(vals)
res.onchange_product_id()
return res


아바타
취소
베스트 답변

You cannot you can only just override the create/write methods like Sudhir Arya suggested. 

If you want to do operations before the data is saved you have to do before the super(<your_class_name>).create(vals) method. Then your data is in the vals dict. If you need the record to be already save do it after. Then your data is in the res object.

Oh and you do not need the onchange decorator on the method you wanna execute.

아바타
취소
관련 게시물 답글 화면 활동
0
11월 23
1295
3
6월 21
12790
1
11월 15
5754
1
1월 24
1437
2
7월 22
4773