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

HI,

I am creating record in two way 1. from xmlrpc script using php 2. As normal create in openerp

But i want stop few operation when record is created from xmlrpc script(php) when create method call (i have overwrite creat method) but i not able identify from where record is created from script or as normal created from openerp.

So help me how to identify record create from xmlrpc script using php

アバター
破棄
最善の回答

You can use a simple trick by passing an extra variable in dictionary when creating record using xmlrpc, and in override create/write method check it in context as.

In php,

> $context = array(
>             'from_xmlrpc' => new xmlrpcval('from_xmlrpc', "string")
>         ); .... $msg->addParam(new xmlrpcval($context, "struct"));

In python,

> def
> write(self,cr,uid,ids,vals,context=None):
>     if context is None:   context = {}
>     if context.has_key('from_xmlrpc'):
>         do-nothing

Hope it will solved your problem.

アバター
破棄
著作者

Thanks for answer but is there way to know without pass context in php..because i want know in my python code where i override create and write method

関連投稿 返信 ビュー 活動
0
3月 18
4017
2
3月 15
10146
1
1月 23
4828
1
4月 21
7040
1
5月 18
5567