skilld-labs / go-odoo

Golang wrapper for Odoo API
Apache License 2.0
86 stars 62 forks source link

How to consult with or? #41

Open jsebasmuller opened 1 year ago

jsebasmuller commented 1 year ago

Hello friends, I am trying to make a query to sale.order and I want to filter by state, currently I am doing it as follows:

criteria.Add("state", "=", "cancel").Add("state", "=", "draft").Add("state", "=", "sent") where criteria is a variable NewCriteria() this seems to work as an "logical operator and" and i need to work it as "logical operator or".

Could you please help me?, thanks for the answers.

ahuret commented 1 year ago

Hey @jsebasmuller ! This feature was indeed missing. I added concepts of combined criterions in latest library version 1.6.0 and updated the README accordingly => https://github.com/skilld-labs/go-odoo/tree/v1.6.0#combined-criterions . I consider this issue as resolved, please reopen it if you have any issue with new implementation. ++

jsebasmuller commented 1 year ago

Hello @ahuret that Or function is only available in version 1.6.0? I can't find it in the last ones.

ahuret commented 1 year ago

the functions are available in both 1.6.0 and master => https://github.com/skilld-labs/go-odoo/blob/master/odoo.go#L140

jsebasmuller commented 1 year ago

Thanks for the help @ahuret , if you want to do more than two conditions, how can you do it? I see that it only receives two conditions in the or function

ahuret commented 1 year ago

Hello dear @jsebasmuller , I need to check if it's possible as documentation is not clear to me, and if so I will implement a way to do it. Reopening for now.