Skip to Content
Odoo Menú
  • Registra entrada
  • Prova-ho gratis
  • Aplicacions
    Finances
    • Comptabilitat
    • Facturació
    • Despeses
    • Full de càlcul (IA)
    • Documents
    • Signatura
    Vendes
    • CRM
    • Vendes
    • Punt de venda per a botigues
    • Punt de venda per a restaurants
    • Subscripcions
    • Lloguer
    Imatges de llocs web
    • Creació de llocs web
    • Comerç electrònic
    • Blog
    • Fòrum
    • Xat en directe
    • Aprenentatge en línia
    Cadena de subministrament
    • Inventari
    • Fabricació
    • PLM
    • Compres
    • Manteniment
    • Qualitat
    Recursos humans
    • Empleats
    • Reclutament
    • Absències
    • Avaluacions
    • Recomanacions
    • Flota
    Màrqueting
    • Màrqueting Social
    • Màrqueting per correu electrònic
    • Màrqueting per SMS
    • Esdeveniments
    • Automatització del màrqueting
    • Enquestes
    Serveis
    • Projectes
    • Fulls d'hores
    • Servei de camp
    • Suport
    • Planificació
    • Cites
    Productivitat
    • Converses
    • Validacions
    • IoT
    • VoIP
    • Coneixements
    • WhatsApp
    Aplicacions de tercers Odoo Studio Plataforma d'Odoo al núvol
  • Sectors
    Comerç al detall
    • Llibreria
    • Botiga de roba
    • Botiga de mobles
    • Botiga d'ultramarins
    • Ferreteria
    • Botiga de joguines
    Food & Hospitality
    • Bar i pub
    • Restaurant
    • Menjar ràpid
    • Guest House
    • Distribuïdor de begudes
    • Hotel
    Immobiliari
    • Agència immobiliària
    • Estudi d'arquitectura
    • Construcció
    • Gestió immobiliària
    • Jardineria
    • Associació de propietaris de béns immobles
    Consultoria
    • Empresa comptable
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Mobles
    • Menjar
    • Brewery
    • Regals corporatius
    Salut i fitness
    • Club d'esport
    • Òptica
    • Centre de fitness
    • Especialistes en benestar
    • Farmàcia
    • Perruqueria
    Trades
    • Servei de manteniment
    • Hardware i suport informàtic
    • Sistemes d'energia solar
    • Shoe Maker
    • Serveis de neteja
    • Instal·lacions HVAC
    Altres
    • Nonprofit Organization
    • Agència del medi ambient
    • Lloguer de panells publicitaris
    • Fotografia
    • Lloguer de bicicletes
    • Distribuïdors de programari
    Browse all Industries
  • Comunitat
    Aprèn
    • Tutorials
    • Documentació
    • Certificacions
    • Formació
    • Blog
    • Pòdcast
    Potenciar l'educació
    • Programa educatiu
    • Scale-Up! El joc empresarial
    • Visita Odoo
    Obtindre el programari
    • Descarregar
    • Comparar edicions
    • Novetats de les versions
    Col·laborar
    • GitHub
    • Fòrum
    • Esdeveniments
    • Traduccions
    • Converteix-te en partner
    • Services for Partners
    • Registra la teva empresa comptable
    Obtindre els serveis
    • Troba un partner
    • Troba un comptable
    • Contacta amb un expert
    • Serveis d'implementació
    • Referències del client
    • Suport
    • Actualitzacions
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Programar una demo
  • Preus
  • Ajuda

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

  • CRM
  • e-Commerce
  • Comptabilitat
  • Inventari
  • PoS
  • Projectes
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
Ajuda

How do I put XMLRPC parameters to list record

Subscriure's

Get notified when there's activity on this post

This question has been flagged
xmlrpcjava
2 Respostes
15124 Vistes
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
Descartar
Avatar
IGAM Muliarsa
Autor 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
Descartar
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
Descartar
Enjoying the discussion? Don't just read, join in!

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

Registrar-se
Related Posts Respostes Vistes Activitat
How to access ODOO 8 using Java xmlrpc? Solved
xmlrpc java
Avatar
2
d’abr. 15
16884
Email Invoices and Quotations using Java and XMLRPC
xmlrpc java odoo
Avatar
Avatar
1
de jul. 25
2395
Retrieve many2one field value using xmlrpc java
many2one xmlrpc java
Avatar
Avatar
2
de març 15
11867
xmlrpc Error when attempting to connect to my local instance Solved
xmlrpc
Avatar
Avatar
Avatar
3
de jul. 25
4404
Cannot marshal None unless allow_none is enabled
xmlrpc
Avatar
1
d’oct. 24
3172
Community
  • Tutorials
  • Documentació
  • Fòrum
Codi obert
  • Descarregar
  • GitHub
  • Runbot
  • Traduccions
Serveis
  • Allotjament a Odoo.sh
  • Suport
  • Actualització
  • Desenvolupaments personalitzats
  • Educació
  • Troba un comptable
  • Troba un partner
  • Converteix-te en partner
Sobre nosaltres
  • La nostra empresa
  • Actius de marca
  • Contacta amb nosaltres
  • Llocs de treball
  • Esdeveniments
  • Pòdcast
  • Blog
  • Clients
  • Informació legal • Privacitat
  • Seguretat
الْعَرَبيّة 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 és un conjunt d'aplicacions empresarials de codi obert que cobreix totes les necessitats de la teva empresa: CRM, comerç electrònic, comptabilitat, inventari, punt de venda, gestió de projectes, etc.

La proposta única de valor d'Odoo és ser molt fàcil d'utilitzar i estar totalment integrat, ambdues alhora.

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