Skip to Content
Odoo Menu
  • Prijavi
  • Try it free
  • Aplikacije
    Finance
    • Knjigovodstvo
    • Obračun
    • Stroški
    • Spreadsheet (BI)
    • Dokumenti
    • Podpisovanje
    Prodaja
    • CRM
    • Prodaja
    • POS Shop
    • POS Restaurant
    • Naročnine
    • Najem
    Spletne strani
    • Website Builder
    • Spletna trgovina
    • Blog
    • Forum
    • Pogovor v živo
    • eUčenje
    Dobavna veriga
    • Zaloga
    • Proizvodnja
    • PLM
    • Nabava
    • Vzdrževanje
    • Kakovost
    Kadri
    • Kadri
    • Kadrovanje
    • Odsotnost
    • Ocenjevanja
    • Priporočila
    • Vozni park
    Marketing
    • Družbeno Trženje
    • Email Marketing
    • SMS Marketing
    • Dogodki
    • Avtomatizacija trženja
    • Ankete
    Storitve
    • Projekt
    • Časovnice
    • Storitve na terenu
    • Služba za pomoč
    • Načrtovanje
    • Termini
    Produktivnost
    • Razprave
    • Odobritve
    • IoT
    • Voip
    • Znanje
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industrije
    Trgovina na drobno
    • Book Store
    • Trgovina z oblačili
    • Trgovina s pohištvom
    • Grocery Store
    • Trgovina s strojno opremo računalnikov
    • Trgovina z igračami
    Food & Hospitality
    • Bar and Pub
    • Restavracija
    • Hitra hrana
    • Guest House
    • Beverage Distributor
    • Hotel
    Nepremičnine
    • Real Estate Agency
    • Arhitekturno podjetje
    • Gradbeništvo
    • Estate Management
    • Vrtnarjenje
    • Združenje lastnikov nepremičnin
    Svetovanje
    • Računovodsko podjetje
    • Odoo Partner
    • Marketinška agencija
    • Law firm
    • Pridobivanje talentov
    • Audit & Certification
    Proizvodnja
    • Tekstil
    • Metal
    • Pohištvo
    • Hrana
    • Brewery
    • Poslovna darila
    Health & Fitness
    • Športni klub
    • Trgovina z očali
    • Fitnes center
    • Wellness Practitioners
    • Lekarna
    • Frizerski salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Sistemi sončne energije
    • Izdelovalec čevljev
    • Čistilne storitve
    • HVAC Services
    Ostali
    • Neprofitna organizacija
    • Agencija za okolje
    • Najem oglasnih panojev
    • Fotografija
    • Najem koles
    • Prodajalec programske opreme
    Browse all Industries
  • Skupnost
    Learn
    • Tutorials
    • Dokumentacija
    • Certifikati
    • Šolanje
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Prenesi
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Dogodki
    • Prevodi
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Sklici kupca
    • Podpora
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Določanje cen
  • Pomoč

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

  • CRM
  • e-Commerce
  • Knjigovodstvo
  • Zaloga
  • PoS
  • Projekt
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
Pomoč

How do I put XMLRPC parameters to list record

Naroči se

Get notified when there's activity on this post

This question has been flagged
xmlrpcjava
2 Odgovori
15024 Prikazi
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
Opusti
Avatar
IGAM Muliarsa
Avtor 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
Opusti
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
Opusti
Enjoying the discussion? Don't just read, join in!

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

Prijavi
Related Posts Odgovori Prikazi Aktivnost
How to access ODOO 8 using Java xmlrpc? Solved
xmlrpc java
Avatar
2
apr. 15
16771
Email Invoices and Quotations using Java and XMLRPC
xmlrpc java odoo
Avatar
Avatar
1
jul. 25
2307
Retrieve many2one field value using xmlrpc java
many2one xmlrpc java
Avatar
Avatar
2
mar. 15
11727
xmlrpc Error when attempting to connect to my local instance Solved
xmlrpc
Avatar
Avatar
Avatar
3
jul. 25
4203
Cannot marshal None unless allow_none is enabled
xmlrpc
Avatar
1
okt. 24
3065
Community
  • Tutorials
  • Dokumentacija
  • Forum
Open Source
  • Prenesi
  • Github
  • Runbot
  • Prevodi
Services
  • Odoo.sh Hosting
  • Podpora
  • Nadgradnja
  • Custom Developments
  • Izobraževanje
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Sredstva blagovne znamke
  • Kontakt
  • Zaposlitve
  • Dogodki
  • Podcast
  • Blog
  • Stranke
  • Pravno • Zasebnost
  • Varnost
الْعَرَبيّة 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 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