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 to Create Custom Invoice PDF Report with Odoo Module

Subscribe

Get notified when there's activity on this post

This question has been flagged
modulesinvoicereportingpdfreport
1 Reply
7884 Views
Avatar
headkit

I'm looking to generate a customized PDF report for invoices. I've successfully created a similar report for quotes 8and also for invoices within Flectra), but I'm facing some challenges when it comes to invoices.

Could someone kindly guide me on the step-by-step process of creating a custom Invoice PDF report using a module in Odoo 17? I'm particularly interested in understanding the necessary configurations, QWeb templates, and any other relevant details that would help me achieve this.

I want to understand what's the difference in concept bewteen sales order/quote and invoices.

Thnx!

-1
Avatar
Discard
headkit
Author

In Flectra I had to add a template file with

<template id="report_aime_invoice" inherit_id="account.report_invoice_document">

where I then replaced the PAGE section with

<xpath expr="//div[hasclass('page')]" position="replace">

Avatar
Mily Shajan
Best Answer

Hi 

You can create a report action for the account.move as the model and binding model, and then update the proper template with style and fields.

Create PDF Report in Odoo 17 

PDF Report


Regards

0
Avatar
Discard
headkit
Author

Thank you for your answer, but it just explains how to add a custom report, ie. for products. In my case I want to override the invoice report and for that I need direct instructions about how to register the record (from my understanding), like
<record id="custom_invoice_layout" model="ir.actions.report">...
or how to register my qweb template file
<template id="invoice_layout_custom">...

headkit
Author

from your suggestion it would be something like

<record id="custom_invoice_layout" model="ir.actions.report">
<field name="name">Custom Invoice Layout</field>
<field name="model">account.move</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">custom_odoo_templates.invoice_layout_custom</field>
<field name="report_file">custom_odoo_templates.invoice_layout_custom</field>
<field name="report_file">account.report_invoice</field>
<!-- <field name="print_report_name">'Invoice_%s' % (object.name)</field> -->
<field name="binding_model_id" ref="account.model_account_move"/>
<field name="binding_type">report</field>
</record>

headkit
Author

if I use that, I get the error
odoo.addons.base.models.ir_qweb.QWebException: Error while render the template
KeyError: 'doc'
Template: custom_odoo_templates.quote_layout_custom

so for me it looks like the invoice report is being rendered using the (overridden) quote (sale.order) template.

headkit
Author

I now deleted the <record> and just work with
<template id="invoice_layout_custom" inherit_id="account.report_invoice_with_payments">
I also added t-if="doc" everywhere in the <template id="quote_layout_custom"> tags and it now looks like the rendering reaches the default invoice templat as I now get the KeyError
KeyError: 'o'
Template: account.report_invoice_with_payments
Questions arise like: Why does it renders the sale order template before? And why is there no o-Object any more?

Mily Shajan

If you need to create a new invoice report try this <record id="action_invoice_report" model="ir.actions.report">
<field name="name">Invoice Report</field>
<field name="model">account.move</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">invoice_report.report_invoice_template</field>
<field name="report_file">invoice_report.report_invoice_template</field>
<field name="print_report_name">'Report - %s' % (object.name)</field>
<field name="binding_model_id" ref="account.model_account_move"/>
<field name="binding_type">report</field>
</record>

otherwise, if you need to inherit the default invoice report and make changes use inherit_id and call this template account.report_invoice_document
<template id="report_invoice_document" inherit_id="account.report_invoice_document">
inside you can add the updates
</template>

headkit
Author

trying to inherit the default invoice report with

<record id="custom_invoice_layout" model="ir.actions.report">
<field name="name">Custom Invoice Layout</field>
<field name="model">account.move</field>
<field name="inherit_id">custom_odoo_templates.invoice_layout_custom</field>
</record>

I get the error

ValueError: Invalid field 'inherit_id' on model 'ir.actions.report'

Mily Shajan

inherit_id is in the report template, not in ir.actions_report model

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
Where can I download the simplest module with an RML report?
modules reporting
Avatar
Avatar
Avatar
2
Mar 15
4576
Displaying the conversion rate on the invoice report
accounting invoice reporting
Avatar
0
Jan 25
1968
Printed Offers and Reports are missing the headers and footers Solved
invoice reporting v15
Avatar
Avatar
Avatar
Avatar
4
Jul 23
8702
How to view detailed payment reports for invoices
invoice reporting Reports
Avatar
0
Jun 23
2535
Odoo Down payment show the individual products instead of just down payment
invoice reporting v15
Avatar
Avatar
1
Mar 25
3061
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