Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Artificial Intelligence
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Property Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Pricing
  • Help
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
Help

How do I put XMLRPC parameters to list record

Subscribe

Get notified when there's activity on this post

This question has been flagged
xmlrpcjava
2 Replies
16451 Views
Avatar
IGAM Muliarsa

anyone can help me to put XMLRPC parameters to list record?

I wrote this method and change the parameters from :

asList((Object[])models.execute("execute_kw", asList(
db, uid, password,
"res.partner", "search",
asList(asList(
asList("is_company", "=", true),
asList("customer", "=", true)))
)));

 to 

Object[] paramsMethod = new Object[]{
new Object[] {"is_company", "=", true},
new Object[] {"customer", "=", true}
};
Object[] params = new Object[] {db, uid, password, resource, action, paramsMethod};
Object result = client.execute("execute_kw", params);
System.out.println("done");

and error arise:

Exception in thread "main" org.apache.xmlrpc.XmlRpcException: Traceback (most recent call last):

File "/usr/lib/python2.7/dist-packages/openerp/service/wsgi_server.py", line 75, in xmlrpc_return

result = openerp.http.dispatch_rpc(service, method, params)

File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 114, in dispatch_rpc

result = dispatch(method, params)

File "/usr/lib/python2.7/dist-packages/openerp/service/model.py", line 37, in dispatch

res = fn(db, uid, *params)

File "/usr/lib/python2.7/dist-packages/openerp/service/model.py", line 162, in execute_kw

return execute(db, uid, obj, method, *args, **kw or {})

File "/usr/lib/python2.7/dist-packages/openerp/service/model.py", line 113, in wrapper

return f(dbname, *args, **kwargs)

File "/usr/lib/python2.7/dist-packages/openerp/service/model.py", line 170, in execute

res = execute_cr(cr, uid, obj, method, *args, **kw)

File "/usr/lib/python2.7/dist-packages/openerp/service/model.py", line 159, in execute_cr

return getattr(object, method)(cr, uid, *args, **kw)

File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 241, in wrapper

return old_api(self, *args, **kwargs)

File "/usr/lib/python2.7/dist-packages/openerp/models.py", line 1639, in search

return self._search(cr, user, args, offset=offset, limit=limit, order=order, context=context, count=count)

File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 241, in wrapper

return old_api(self, *args, **kwargs)

File "/usr/lib/python2.7/dist-packages/openerp/addons/base/res/res_partner.py", line 656, in _search

count=count, access_rights_uid=access_rights_uid)

File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 241, in wrapper

return old_api(self, *args, **kwargs)

File "/usr/lib/python2.7/dist-packages/openerp/models.py", line 4621, in _search

query = self._where_calc(cr, user, args, context=context)

File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 241, in wrapper

return old_api(self, *args, **kwargs)

File "/usr/lib/python2.7/dist-packages/openerp/models.py", line 4438, in _where_calc

if not any(item[0] == 'active' for item in domain):

File "/usr/lib/python2.7/dist-packages/openerp/models.py", line 4438, in <genexpr>

if not any(item[0] == 'active' for item in domain):

TypeError: 'bool' object has no attribute '__getitem__'

at org.apache.xmlrpc.client.XmlRpcStreamTransport.readResponse(XmlRpcStreamTransport.java:197)

at org.apache.xmlrpc.client.XmlRpcStreamTransport.sendRequest(XmlRpcStreamTransport.java:156)

at org.apache.xmlrpc.client.XmlRpcHttpTransport.sendRequest(XmlRpcHttpTransport.java:143)

at org.apache.xmlrpc.client.XmlRpcSunHttpTransport.sendRequest(XmlRpcSunHttpTransport.java:69)

at org.apache.xmlrpc.client.XmlRpcClientWorker.execute(XmlRpcClientWorker.java:56)

at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:167)

at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:137)

at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:126)

at TutorialLocal.listRecord(TutorialLocal.java:193)

at TutorialLocal.main(TutorialLocal.java:81)

This is the method:

static Object listRecord(int uid, String url, String db, String username, String password, String resource, String action) throws MalformedURLException, XmlRpcException {
      XmlRpcClient client = new XmlRpcClient();
      XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
      config.setEnabledForExtensions(true);
      //config.setServerURL(new URL(url+"/xmlrpc/object")); // OK
      config.setServerURL(new URL(url+"/xmlrpc/2/object")); // OK
      client.setConfig(config);
      Object[] paramsMethod = new Object[]{
          new Object[] {"is_company", "=", true},
           new Object[] {"customer", "=", true}
      };
      System.out.println(resource);
      System.out.println(action);
      System.out.println(paramsMethod.toString());
      Object[] params = new Object[] {db, uid, password, resource, action, paramsMethod};
      Object result = client.execute("execute_kw", params);
      System.out.println("done");
      return result;
}

0
Avatar
Discard
Avatar
IGAM Muliarsa
Author Best Answer

hi.....

don worry about the question, I found the solution. please try and give correct answer. :D

public static void main(String[] args) {
    // "res.partner", "search",
    System.out.println();
    System.out.println("Search res.partner");
    System.out.println("--------------");  
    Object rLR = listRecord(uid, url, db, username, password, "res.partner", "search");
    Object[] tRLR = (Object[])rLR;
    for (int i=0;i<tRLR.length;i++) {
        System.out.println(tRLR[i]);
    }
}
static Object listRecord(int uid, String url, String db, String username, String password, String resource, String action) throws MalformedURLException, XmlRpcException {
    XmlRpcClient client = new XmlRpcClient();
    XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
    config.setEnabledForExtensions(true);
    //config.setServerURL(new URL(url+"/xmlrpc/object")); // OK
    config.setServerURL(new URL(url+"/xmlrpc/2/object")); // OK
    client.setConfig(config);
    Object[] paramsMethod = new Object[]{
    new Object[] {
        new Object[] {"is_company", "=", true},
        new Object[] {"customer", "=", true}
        }
    };
    HashMap<Object,Object> paramsRules = new HashMap<Object, Object>() ;
    //paramsRules.put("offset",10);
    //paramsRules.put("limit",5);
    Object[] params = new Object[] {db, uid, password, resource, action, paramsMethod, paramsRules};
    Object result = client.execute("execute_kw", params);
    return result;
}


0
Avatar
Discard
Avatar
Mind And Go
Best Answer

Maybe you could try to use the openerp-java lib that is pretty mature : https://github.com/DeBortoliWines/openerp-java-api

It is used in Pentaho Project and works for most of the releases

0
Avatar
Discard
Enjoying the discussion? Don't just read, join in!

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

Sign up
Related Posts Replies Views Activity
How to access ODOO 8 using Java xmlrpc? Solved
xmlrpc java
Avatar
2
Apr 15
18259
Email Invoices and Quotations using Java and XMLRPC
xmlrpc java odoo
Avatar
Avatar
1
Jul 25
3275
Retrieve many2one field value using xmlrpc java
many2one xmlrpc java
Avatar
Avatar
2
Mar 15
12748
xmlrpc Error when attempting to connect to my local instance Solved
xmlrpc
Avatar
Avatar
Avatar
3
Jul 25
6161
Cannot marshal None unless allow_none is enabled
xmlrpc
Avatar
1
Oct 24
4599
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security
الْعَرَبيّة 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 Svenska ภาษาไทย Türkçe українська Tiếng Việt

Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

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