Skip to Content
Odoo Menu
  • Prisijungti
  • Išbandykite nemokamai
  • Programėlės
    Finansai
    • Apskaita
    • Pateikimas apmokėjimui
    • Sąnaudos
    • Skaičiuoklė (BI)
    • Dokumentai
    • Pasirašymas
    Pardavimai
    • CRM
    • Pardavimai
    • Kasų sistema - Parduotuvė
    • Kasų sistema - Restoranas
    • Prenumeratos
    • Nuoma
    Svetainės
    • Svetainių kūrėjimo įrankis
    • El. Prekyba
    • Internetinis Tinklaraštis
    • Forumas
    • Tiesioginis pokalbis
    • eMokymasis
    Tiekimo grandinė
    • Atsarga
    • Gamyba
    • PLM
    • Įsigijimai
    • Priežiūra
    • Kokybė
    Žmogaus ištekliai
    • Darbuotojai
    • Įdarbinimas
    • Atostogos
    • Įvertinimai
    • Rekomendacijos
    • Transporto priemonės
    Rinkodara
    • Socialinė rinkodara
    • Rinkodara el. paštu
    • SMS rinkodara
    • Renginiai
    • Rinkodaros automatizavimas
    • Apklausos
    Paslaugos
    • Projektas
    • Darbo laiko žiniaraščiai
    • Priežiūros tarnyba
    • Pagalbos tarnyba
    • Planavimas
    • Rezervacijos
    Produktyvumas
    • Diskucija
    • Patvirtinimai
    • IoT
    • VoIP
    • Žinių biblioteka
    • WhatsApp
    Trečiųjų šalių programos Odoo Studija Odoo debesijos platforma
  • Pramonės šakos
    Mažmeninė prekyba
    • Knygynas
    • Drabužių parduotuvė
    • Baldų parduotuvė
    • Maisto prekių parduotuvė
    • Techninės įrangos parduotuvė
    • Žaislų parduotuvė
    Food & Hospitality
    • Barai ir pub'ai
    • Restoranas
    • Greitasis maistas
    • Guest House
    • Gėrimų platintojas
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architektūros įmonė
    • Konstrukcija
    • Estate Managament
    • Sodininkauti
    • Turto savininkų asociacija
    Consulting
    • Accounting Firm
    • Odoo Partneris
    • Marketing Agency
    • Teisinė firma
    • Talentų paieška
    • Auditai & sertifikavimas
    Gamyba
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Įmonių dovanos
    Sveikata & Fitnesas
    • Sporto klubas
    • Akinių parduotuvė
    • Fitneso Centras
    • Sveikatos praktikai
    • Vaistinė
    • Kirpėjas
    Trades
    • Handyman
    • IT įranga ir palaikymas
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Aplinkos agentūra
    • Reklaminių stendų nuoma
    • Fotografavimas
    • Dviračių nuoma
    • Programinės įrangos perpardavėjas
    Browse all Industries
  • Bendrija
    Mokykitės
    • Mokomosios medžiagos
    • Dokumentacija
    • Sertifikatai
    • Mokymai
    • Internetinis Tinklaraštis
    • Tinklalaidės
    Skatinkite švietinimą
    • Švietimo programa
    • Scale Up! Verslo žaidimas
    • Aplankykite Odoo
    Gaukite programinę įrangą
    • Atsisiųsti
    • Palyginkite versijas
    • Leidimai
    Bendradarbiauti
    • Github
    • Forumas
    • Renginiai
    • Vertimai
    • Tapkite partneriu
    • Services for Partners
    • Registruokite jūsų apskaitos įmonę
    Gaukite paslaugas
    • Susiraskite partnerį
    • Susirask buhalterį
    • Susitikti su konsultantu
    • Diegimo paslaugos
    • Klientų rekomendavimas
    • Palaikymas
    • Atnaujinimai
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Gaukite demo
  • Kainodara
  • Pagalba

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Apskaita
  • Atsarga
  • PoS
  • Projektas
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
Pagalba

XML-RPC API - object/search mixing AND and OR?

Prenumeruoti

Get notified when there's activity on this post

This question has been flagged
searchxmlrpcobject
1 Atsakyti
12486 Rodiniai
Portretas
Jason Judge

The documentation shows the search criteria of a search being a list of tuples, which are all ANDed together. Is there a way, through the API, to use more complex mixes of AND and OR. For example, given the two external IDs base.my_id_1 and l10n_uk.my_id_2, to search for both of these at the same time, I would need to search the ir.module.data model for:

model = whatever.searching.model

AND (

    (module = base AND name = my_id_1)

    OR

    (module = l10n_uk AND name = my_id_2)

)

Can that be done through the API on one call to object/search? Or would I need to do two searches - one for each module - and merge the results together?

Thanks.

Answer

Ray pointed the answer to a previous post which shows how polish notation is used. For my above example, the "(module = base AND name = my_id_1)" criteria is represented by the following elements in the criteria array (in PHP, as that's what I'm using):

"&",

["module", "=", "base"],

["name", "=", "my_id_1"]

This can be repeated as many times as needed, say N times.

Now to OR these together, the above array is prepended with N-1 "|" elements. So the full example from above, with N=2, would look like this:

[

"|",

"&",

["module", "=", "base"],

["name", "=", "my_id_1"],

"&",

["module", "=", "l10n_uk"],

["name", "=", "my_id_2"],

]

That's very easy to knock up programmatically for any value of N (just a few lines like this https://github.com/academe/openerpapi/blob/master/src/Interfaces/Object.php#L215). Additional criteria elements can be prepended (and I assume appended) to that, and they don't seem to need "&"s of their own. So the criteria does not need to be strcitly 100% polish, as the "&" operator is assumed where no operator is given, and that is how not using any "&" or "|" elements at all works anyway.

Thanks :-) Hope that's helpful to others. In all my years of coding, this is the first time I have actually had to use polish notation, and it seems fun. I would recommend anyone wanting to do this read follow your links and see how it works - my example above is not the general solution, but the application of the polish notation to my specific case, which is all data-driven (I've just plugged in the specific example values for illustration).

0
Portretas
Atmesti
Jason Judge
Autorius

Thanks Ray - polish notation works a charm :-)

Portretas
Ray Carnes
Best Answer

Just create the appropriate domain for your search, combining any number of AND's and OR's.

My method is explained in https://www.odoo.com/forum/help-1/question/domain-notation-using-multiple-and-nested-and-2170

 

1
Portretas
Atmesti
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Registracija
Related Posts Replies Rodiniai Veikla
Search multiple IDS in XMLRPC
search xmlrpc
Portretas
1
kov. 15
5509
Filter multiple values of field via XMLRPC? Solved
search xmlrpc v11
Portretas
Portretas
2
rugs. 20
6527
Search Active and Inactive Records through XML-RPC , In One Expression odoo 11
search xmlrpc webservices
Portretas
Portretas
1
lapkr. 19
7392
How to search HR Expense with XMLRPC API ?
expenses search xmlrpc
Portretas
1
kov. 15
5678
XMLRPC: How to fetch a list of all ids that belongs to a given model?
v7 search xmlrpc
Portretas
Portretas
Portretas
2
kov. 15
18819
Bendrija
  • Mokomosios medžiagos
  • Dokumentacija
  • Forumas
Atvirasis kodas
  • Atsisiųsti
  • Github
  • Runbot
  • Vertimai
Paslaugos
  • Odoo.sh talpinimas
  • Palaikymas
  • Atnaujinti
  • Pritaikytas programavimo kūrimas
  • Švietimas
  • Susirask buhalterį
  • Susiraskite partnerį
  • Tapkite partneriu
Apie mus
  • Mūsų įmonė
  • Prekės ženklo turtas
  • Susisiekite su mumis
  • Darbo pasiūlymai
  • Renginiai
  • Tinklalaidės
  • Internetinis Tinklaraštis
  • Klientai
  • Teisinis • Privatumas
  • Saugumas
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo yra atvirojo kodo verslo programų rinkinys, kuris apima visas įmonės poreikius: CRM, El. Prekybą, Apskaitą, Atsargų, Kasų sistemą, Projektų valdymą ir kt.

Unikali Odoo vertės pasiūla – būti tuo pačiu metu labai lengvai naudojama ir visiškai integruota sistema.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now