コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
8562 ビュー

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
4170
3
7月 25
2758
1
1月 25
1280
1
10月 24
1968
1
4月 24
2014