Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
7431 Lượt xem

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

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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.

Ảnh đại diện
Huỷ bỏ
Tác giả

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

Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 3 18
4155
2
thg 3 15
10319
1
thg 1 23
4959
1
thg 4 21
7248
1
thg 5 18
5723