How to use "joins" mechanism when calling external API


I have developped a Google Apps module to generate follow up report, for specific business case.

Typically, it fetches data and organize it as per the specific business case, and it works.

However, I'd like to optimize the process, typically by reducing number of calls, and simplifying/reducing the Google Apps Script code/processing.

A practical example:

I want to display list of Purchase Orders and for each display list of associated Stock Pickings.

What I currently do:
  1. search_read, with desired domain, 

  2. create domain based on ids received from point 1.

  3. new search_read, with domain from point 2.

What I want:
  1. A single query that would simulate an SQL INNER JOIN, or different kind of join.

Found some references, in PHP using ripcord (https://stackoverflow.com/questions/45877105/how-to-join-model-in-xmlrpc-using-ripcord).

Building the module inside Odoo is also an option, but not applicable in this specific setup.

Any hints?

Thanks in advance.

Mark Anderson
En iyi cevap

As far as I know, this is not possible. 
The source has no mechanism for joins. It has to be done with two searches. I wrote a simple wrapper for the xmlrpc that includes a join functionality by doing two searches. The first search gets the ids for the second one.
For example if you're looking to join sale.order with sale.order.line, you wind up having to join the two lists in python.
I don't believe there are any shortcuts but I'm sure willing to hear if someone has one...