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

Hello,

I have a _constraint defined with a method :

def _check_me(self, cr, uid, ids, context=None):

context = context or {}

print context

 

_constraints = [(_check_me, 'This is my validation error message', ['field_name'])]

I call the write method on my object using XMLRPC like this, with a context :

socket.execute(db, uid, pwd, 'my_object', 'write', ids, {'field_name':field_value}, {'foo':'bar'})

And it matches the write method signature. But my context is always empty.

It is because context is not passed to methods used for _constraints ? Or am I missing something ?

Thanks

 

아바타
취소
베스트 답변

try:
socket.execute(db, uid, pwd, 'my_object', 'write', ids, {'field_name':field_value}, context={'foo':'bar'})

아바타
취소
작성자

Won't work. You can't actually name variables in xmlrpc calls. Besides, the context is sent to the write method. Problem is : it appears that it does propagate to the method defined in the _contraints.

관련 게시물 답글 화면 활동
0
3월 15
4172
3
7월 25
2764
1
1월 25
1284
1
10월 24
1973
1
4월 24
2017