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

How do we revert the value of the parameter changed by @api.onchange. Or get the original value back.

I'm on odoo Version 9.

Ex: 

@api.onchange('carrier_id')

def on_carrier_changed(self):

    if something:

        # give some warning & do some logic

        # revert back carrier_id

Thanks!

아바타
취소
작성자 베스트 답변

Hi no i didn’t find an answer to that question, but my coworker suggested to change the way I do things to eliminate needing to go into onchange: Doing validation in other area, using domain filter to filter out values I don’t want…etc


Update:

old values are in self._origin. Self only contains new values. Even self.id = openerp.models.NewId

아바타
취소
베스트 답변

Check The Onchange Product if stock is not available it will display warning as well as data will store.

so in your case you can erase your field and raise a warning

아바타
취소
베스트 답변

I'm too new to this forum to post a commentary so please forgive me my 'answer'.

Have you found any solution? I am searching for about an hour now and I cannot find any way how to solve it!

Thank you!

아바타
취소
작성자

old values are in self._origin. Self only contains new values. Even self.id = openerp.models.NewId

관련 게시물 답글 화면 활동
4
5월 23
18241
0
12월 24
1550
1
10월 23
2311
2
10월 23
2537
2
8월 23
4658