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
    • Approvals
    • 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
    • Estate 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

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

  • CRM
  • e-Commerce
  • Accounting
  • Inventory
  • PoS
  • Project
  • MRP
All apps
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 take "product.pricelist" on through "search_read" in Java with External API?

Subscribe

Get notified when there's activity on this post

This question has been flagged
productapijava
7778 Views
Avatar
Augusto Sanson Cadini

I did read the models through XMLRPC Java lib, and I can read all models, for example:


try {
            models_config.setServerURL(new URL(host + "/xmlrpc/2/object"));
            models.setConfig(models_config);

            Object[] lista = (Object[]) models.execute("execute_kw",
                                                              asList(
                                                                      db,
                                                                      uid,
                                                                      password,
                                                                      "product.template",
                                                                      "search_read",
                                                                      asList(asList())
                                                                      ,new HashMap() {{  put("limit",1); }}                                                     )                                                                
            );
            for( Object obj : lista ) {
                System.out.println(String.valueOf(obj));
            }      
         } catch (Exception e) {
             e.printStackTrace();
         }


This return correctely to me:

{write_date=2018-03-23 14:49:50, company_ax_id=[Ljava.lang.Object;@4b952a2d, description_purchase=false, message_partner_ids=[Ljava.lang.Object;@3159c4b8, lst_price=1.0, qty_amount=0.0, message_channel_ids=[Ljava.lang.Object;@73846619, attribute_line_ids=[Ljava.lang.Object;@4bec1f0c, type=consu, fiscal_class_code=38089999, description_sale=false, destination_type=sale, seller_ids=[Ljava.lang.Object;@29ca901e, product_variant_count=1, price=0.0, last_update=false, warranty=0.0, id=99, create_date=2018-03-23 14:47:38, default_code=2262, barcode=false, invoice_policy=order, image=, product_variant_ids=[Ljava.lang.Object;@5649fd9b, standard_price=0.0, __last_update=2018-03-23 14:49:50, pricelist_id=false, expense_policy=no, weight=0.0, active=true, message_follower_ids=[Ljava.lang.Object;@6adede5, create_uid=[Ljava.lang.Object;@2d928643, display_name=[2262] Armadilha de Bob c/ Pupa, volume=0.0, sequence=1, uom_id=[Ljava.lang.Object;@5025a98f, image_small=, packaging_ids=[Ljava.lang.Object;@49993335, track_service=manual, item_ids=[Ljava.lang.Object;@20322d26, name=Armadilha de Bob c/ Pupa, categ_id=[Ljava.lang.Object;@192b07fd, write_uid=[Ljava.lang.Object;@64bfbc86, message_is_follower=false, color=0, uom_po_id=[Ljava.lang.Object;@64bf3bbf, sale_ok=true, image_medium=, description=false, taxes_id=[Ljava.lang.Object;@55d56113, message_unread=false, supplier_taxes_id=[Ljava.lang.Object;@148080bb, qty_reserved=0.0, message_last_post=false, property_account_income_id=false, sale_line_warn=no-message, purchase_ok=true, company_id=[Ljava.lang.Object;@dc24521, multiple=1, sales_count=0, list_price=1.0, qty_available=0.0, rental=false, message_unread_counter=0, product_group_id=false, property_account_expense_id=false, message_needaction=false, related_ids=[Ljava.lang.Object;@10bdf5e5, message_needaction_counter=0, message_ids=[Ljava.lang.Object;@6e1ec318, sale_line_warn_msg=false, restricted_view=false, product_variant_id=[Ljava.lang.Object;@7e0b0338, currency_id=[Ljava.lang.Object;@617faa95}


And, this happens with other models. But when I tries get product.pricelist model, in the same code, only change product.template to product.pricelist, I get the error


org.apache.xmlrpc.XmlRpcException: Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/odoo/service/wsgi_server.py", line 56, in xmlrpc_return
    result = odoo.http.dispatch_rpc(service, method, params)
  File "/usr/lib/python2.7/site-packages/odoo/http.py", line 118, in dispatch_rpc
    result = dispatch(method, params)
  File "/usr/lib/python2.7/site-packages/odoo/service/model.py", line 38, in dispatch
    res = fn(db, uid, *params)
  File "/usr/lib/python2.7/site-packages/odoo/service/model.py", line 175, in execute_kw
    return execute(db, uid, obj, method, *args, **kw or {})
  File "/usr/lib/python2.7/site-packages/odoo/service/model.py", line 119, in wrapper
    return f(dbname, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/odoo/service/model.py", line 182, in execute
    res = execute_cr(cr, uid, obj, method, *args, **kw)
  File "/usr/lib/python2.7/site-packages/odoo/service/model.py", line 171, in execute_cr
    return odoo.api.call_kw(recs, method, args, kw)
  File "/usr/lib/python2.7/site-packages/odoo/api.py", line 679, in call_kw
    return call_kw_model(method, model, args, kwargs)
  File "/usr/lib/python2.7/site-packages/odoo/api.py", line 664, in call_kw_model
    result = method(recs, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/odoo/addons/sale_nfe/models/product_pricelist.py", line 33, in search_read
    headers = request.httprequest.headers
  File "/usr/lib/python2.7/site-packages/werkzeug/local.py", line 343, in __getattr__
    return getattr(self._get_current_object(), name)
  File "/usr/lib/python2.7/site-packages/werkzeug/local.py", line 302, in _get_current_object
    return self.__local()
  File "/usr/lib/python2.7/site-packages/werkzeug/local.py", line 135, in _lookup
    raise RuntimeError('object unbound')
RuntimeError: object unbound

The curious, is that when I use the Android library, this not happens, but I need use in Java only. I'm using Netbeans. The API that I using: https://www.odoo.com/documentation/11.0/webservices/odoo.html

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
Calculate taxes and confirm invoice with the API in JAVA
api java
Avatar
0
Apr 18
4996
Create Product via API Solved
product api
Avatar
Avatar
2
Jul 15
14338
java api Solved
api java
Avatar
Avatar
1
Mar 15
7088
How can we authenticate through our java dekstop application to our odoo server ?
api java desktop
Avatar
0
Jun 21
3288
OpenERP Java API Solved
api java webservices
Avatar
Avatar
Avatar
2
Nov 20
15602
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 ภาษาไทย 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