Odoo Help

Welcome!

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.

0

xml-rpc search on many2many query

By
Joeri Belis
on 5/7/13, 12:11 PM 2,588 views

I want to search all res_users that belong to a certain res_company via xml-rpc. The test client is written in .net env. When i keep the search query simple like searching on the "login" field = 'login_name_x' this works fine.

            String[] condition = new String[] { "login", "=", "name_x" };
            ArrayList lstFilters = new ArrayList();
            lstFilters.Add(condition);
            Object[] resSearch = openERPproxy.search(dbname, userID, pwd,res.users",search", lstFilters.ToArray());

But i need to filter on de company_ids where a res_users records belongs to. So i tried following filter as i know there are res_users in company_id 3

            String[] condition = new String[] { "company_ids", "=", "3" };

But this is not a working solution because it returns nothing?!

What is the correct approach to get xml-rpc do search filter on the many2xxx fields?

0

Naresh Soni (nch)

--Naresh Soni (nch)--
Tiny ERP Pvt Ltd
http://www.odoo.com
1281
| 2 2 4
India
--Naresh Soni (nch)--

Team Lead, Odoo(Formerly OpenERP) Support & OPW

Naresh Soni (nch)
On 5/7/13, 1:53 PM

Hello Joeri,

use String[] condition = new String[] { "company_ids", "in", [3] };

Thanks,

[3] is not working, it needs to be a string. but no success yet

Joeri Belis
on 5/8/13, 11:50 AM

Joeri, not sure how do you write a list([]) in .net but OpenERP will expect a list here as company_ids is a Many2many

Naresh Soni (nch)
on 5/8/13, 2:23 PM
0

Martin

--Martin--
1978
| 5 6 8
Cornwall, Canada
--Martin--

Analysing, designing, coding and mentoring since 1975. Kilobytes to terabytes. Punch cards to punchy sites. My OpenERP video series: http://www.youtube.com/playlist?list=PLq7op4J183lX44ZlXPiHxUpRvmmRDtxye My Google Speadsheets --> OpenERP Data Pump project: http://martinhbramwell.github.io/GData_OpenERP_Data_Pump My email (with spaces removed) : mhb . warehouseman @ gmail . com

Martin
On 5/7/13, 1:34 PM

You can find some examples of XMLRPC usage here ...

https://gist.github.com/t3dev/3016471

... and here ...

GData_OpenERP_Data_Pump

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)

Stats

Asked: 5/7/13, 12:11 PM
Seen: 2588 times
Last updated: 3/16/15, 8:10 AM