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

I would like to determine whether the constraint has been triggered due to a user-initiated change from the Odoo UI or if it has been triggered from within the internal code of another application.


The code would be something like that:


class StockMove(models.Model):
_inherit = "stock.move"

​@api.constrains('sequence')
​def _constrains_sequence(self):
​​if comes_from_UI:
​raise ValidationError(_("Not allowed to change the sequence of moves from the picking."))

아바타
취소
베스트 답변

Hey, 


Maybe you can write onchange it will fit your needs.

Thanks

아바타
취소
작성자

Hi Jay,

Thank you for your response. However, from my understanding, the onchange methods are executed not only when modifying values from the UI but also when modifying them from the code.

So, I would encounter the same issue while attempting to differentiate whether that change originates from a UI modification.

관련 게시물 답글 화면 활동
5
5월 25
46344
0
8월 25
73
1
8월 25
1994
1
7월 25
2542
2
7월 25
7982