Odoo Help

1 Answer
Sam Davey
8/15/13, 7:32 PM

I'm not surprised no one has answered this. There is no magic 'run wizard' XMLRPC call. It's a series of calls.

As per the documentation "Everything done in the GTK or web client in OpenERP is through XML/RPC webservices. Start openERP GTK client using ./openerp-client.py -l debug_rpc (or debug_rpc_answer) then do what you want in the GTK client and watch your client logs, you will find out the webservice signatures."

I was thrown by this as I can't use the client with version 7. But of course the web client essentially does exactly the sae thing as the GTK client so I just needed to turn on debugging on the server and watch the logs for the webservice signatures.

So to do this you just add "log_level = debug_rpc_answer" to your server config file (openerp-server.conf in my instance)

Once I'd done that I could see what was going on and replicated it in PHP.

I'm not going to go into detail here. If you need to do the same then you just need to get to 'debug_rpc_answer' and start analysing the webservice signatures.

But for completeness the process looks like this

  • Fill in the context for the call
  • Call default_get to get the data for the wizard
  • Alter the data as needed then call create, this creates an object in memory and returns an identifier for it
  • In my case I then call 'create_returns' which converts the in memory object into the corresponing incoming shipment record

Heres how it looks although I've stripped out some bits

// First build the context of the request, i.e. in my case the Delivery Order I am creating a return for
$activeId = 7;

$args = array(

$context = array(
    "context" => array(
        'active_id'=> $activeId,
        'active_ids'=> array($activeId),
        'active_model'=> 'stock.picking.out',
        contact_display'=> 'partner_address',
        'default_type'=> 'out',
        'lang'=> 'en_GB',
        'search_disable_custom_filters'=> True,
        'tz'=> 'Europe/London',
        'uid'=> 1,

// Call 'default_get' which returns all the data that gets filled in the UI when you click 'Return Products'

$results = $client->call('execute_kw', array($dbName, $user, $pwd, 'stock.return.picking', 'default_get', $args, $context));

$previousMoves = $results['product_return_moves'];

// Do stuff with previousMoves to build the actual productReturnMoves needed
... omitted for brevity ...

$args = array(
            'invoice_state' => 'none',
            'product_return_moves' => $productReturnMoves,

$results = $client->call('execute_kw', array($dbName, $user, $pwd, 'stock.return.picking', 'create', $args, $context));

// An identifier for this 'in memory' (TransientModel) object is returned
$wizardId = $results;

// Call the method that converts the 'in memory' (TransientModel) object into corresponding object
$args = array(

$blank = array();

$results = $client->call('execute_kw', array($dbName, $user, $pwd, 'stock.return.picking', 'create_returns', $args, $blank));

Easy... Or not... depending on how impressed or frustrated you are feeling about OpenERP today :-)

1 Comment
Timothy Solomon
7/22/14, 7:04 AM

Thanks for sharing your answer :) Wizards are just temporary models to work on other models - so best to look at what the wizard does (eg create a incoming shipping order when you click on "return products"). I usually figure out what the code does and then try and reproduce it with RPC, but checking the rpc log is a good idea!

Ask a Question
Keep Informed
0 follower(s)
About This Community

This platform 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.

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now