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

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
3847
2
3월 15
9891
1
1월 23
4687
1
4월 21
6797
1
5월 18
5463