Odoo Help


This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


How to identify record is created from xmlrpc script(php) when create method overrite

on 7/29/13, 4:20 AM 2,462 views


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

Mohit Chabdra
On 7/29/13, 5:37 AM

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

on 7/29/13, 5:41 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)


Asked: 7/29/13, 4:20 AM
Seen: 2462 times
Last updated: 3/16/15, 8:10 AM