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

Get report with XML RPC from Odoo 16

Subscribe

Get notified when there's activity on this post

This question has been flagged
2 Replies
6977 Views
Avatar
Nathanael Lee

Hello all


What is the best way to get a pdf report with XML RPC from Odoo Version 16? Before Version 11 it was possible with the /report endpoint. How should this be done with the newer versions?

Thank you! Best regards

0
Avatar
Discard
Nathanael Lee
Author

Dear Shubham

Thanks for your answer. Unfortunately this does not work, I get the following error:


Traceback (most recent call last):

  File "test3.py", line 19, in

    report_data = report.render_report(db, uid, password, report_name, doc_ids, context)

  File "/usr/lib/python3.5/xmlrpc/client.py", line 1092, in __call__

    return self.__send(self.__name, args)

  File "/usr/lib/python3.5/xmlrpc/client.py", line 1432, in __request

    verbose=self.__verbose

  File "/usr/lib/python3.5/xmlrpc/client.py", line 1134, in request

    return self.single_request(host, handler, request_body, verbose)

  File "/usr/lib/python3.5/xmlrpc/client.py", line 1167, in single_request

    dict(resp.getheaders())

xmlrpc.client.ProtocolError: ProtocolError for URL/RPC2: 404 NOT FOUND




Avatar
shubham shiroya
Best Answer

Here's how you can generate a PDF report using XML-RPC in Odoo version 16:

  1. Connect to your Odoo instance using an XML-RPC client library in your preferred programming language (e.g., Python with the xmlrpc.client module).

  2. Call the render_report method on the report object. This method takes the following parameters:

    • database: The name of the target database.
    • uid: The ID of the user in Odoo (typically the admin user).
    • password: The password of the user.
    • report_name: The technical name of the report to generate.
    • doc_ids: The list of document IDs to include in the report.
    • context: Additional context to provide for report generation.

    The render_report method returns a dictionary containing the report data.

  3. Use the received report data to save the PDF report file locally or process it further according to your requirements.

Example:

import xmlrpc.client

# Connect to Odoo instance
url = 'http://your_odoo_instance_url/xmlrpc/2/object'
db = 'your_database'
username = 'your_username'
password = 'your_password'
common = xmlrpc.client.ServerProxy('{}/common'.format(url))
uid = common.authenticate(db, username, password, {})

# Generate PDF report
report = xmlrpc.client.ServerProxy(url)
report_name = 'module_name.report_name' # Technical name of the report
doc_ids = [1, 2, 3] # IDs of the documents to include in the report
context = {} # Additional context for report generation
report_data = report.render_report(db, uid, password, report_name, doc_ids, context)

# Save the PDF report locally
with open('report.pdf', 'wb') as f:
f.write(report_data['result'])

Make sure to replace 'your_odoo_instance_url', 'your_database', 'your_username', 'your_password', 'module_name.report_name', and [1, 2, 3] with the appropriate values for your Odoo instance and report.

-1
Avatar
Discard
Sagar Shah

getting error

xmlrpc.client.Fault: <Fault 1: 'Traceback (most recent call last):\n File "/mnt/c/Others/odoo16/odoo/addons/base/controllers/rpc.py", line 150, in xmlrpc_2\n response = self._xmlrpc(service)\n File "/mnt/c/Others/odoo16/odoo/addons/base/controllers/rpc.py", line 130, in _xmlrpc\n result = dispatch_rpc(service, method, params)\n File "/mnt/c/Others/odoo16/odoo/http.py", line 366, in dispatch_rpc\n return dispatch(method, params)\n File "/mnt/c/Others/odoo16/odoo/service/model.py", line 39, in dispatch\n raise NameError("Method not available %s" % method)\nNameError: Method not available render_report\n'>

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
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