Skip to content

Unleash the Ultimate Odoo Invoice Receipt Report: 3 Essential Steps

keyphrase odoo invoice receipt report

Unleash the Ultimate Odoo Invoice Receipt Report: 3 Essential Steps

In the dynamic world of business, efficiency and clarity in financial documentation are paramount. While Odoo excels in managing invoices and sales, sometimes the standard functionalities need a little extra refinement to perfectly match specific operational demands. One such refinement often requested by businesses is a dedicated Odoo invoice receipt report. Imagine the ease and professionalism of providing your clients with a clear, concise payment confirmation directly from your Odoo system, tailored to your brand.

This comprehensive guide will walk you through the process of creating a custom receipt report in Odoo, transforming a standard invoice into a sleek, professional payment acknowledgment. We’ll leverage Odoo’s powerful QWeb templating engine and modular design to add this vital functionality. By the end of this tutorial, you’ll be equipped to generate a professional payment receipt, enhancing your financial workflow and client satisfaction.

Why a Custom Odoo Invoice Receipt Report is Indispensable

Before diving into the technical steps, let’s consider why having a custom payment confirmation report is a significant upgrade for any Odoo user:

  • Professionalism: A dedicated receipt report presents a more polished and professional image to your clients, clearly distinguishing it from the initial invoice. It signifies a completed transaction, not just a demand for payment.
  • Clarity for Clients: While an invoice outlines what’s owed, a receipt confirms what’s been paid. This eliminates ambiguity and provides customers with a straightforward proof of payment, crucial for their own record-keeping.
  • Internal Record Keeping: Automating the generation of payment receipts streamlines your internal accounting processes. Every payment gets an official acknowledgment, making reconciliation easier and reducing manual data entry errors.
  • Enhanced Customer Experience: Providing immediate and clear documentation of payments builds trust and improves the overall customer experience. It shows your business is organized and values transparency.
  • Customization: Odoo’s flexibility allows you to include specific details relevant to your business, such as payment methods, transaction IDs, or even a personalized thank you message, making each Odoo invoice receipt report uniquely yours.

If you’re ready to elevate your Odoo accounting experience, let’s dive into the practical implementation. We will create a new Odoo module (addon) to house our custom receipt report, ensuring your system remains clean and easily maintainable.

Step 1: Crafting Your New Odoo Module (Addon) for the Receipt Report

Odoo’s modular architecture encourages creating small, dedicated modules (addons) for customizations. This approach keeps your system organized, makes updates smoother, and prevents conflicts with core Odoo functionalities.

  1. Prepare Your Addons Path: Ensure you have access to your Odoo custom addons directory. This is typically configured in your Odoo server’s configuration file.
  2. Duplicate a Template Module: Start by copying a basic Odoo module template (if you have one) or create a new empty folder. For this tutorial, let’s assume you have a template_addon folder.
  3. Rename Your Module Folder: Rename the copied folder to invoice_receipt. This will be the name of our new Odoo module, dedicated solely to generating the Odoo invoice receipt report.

Step 2: Configuring Your __manifest__.py File

The __manifest__.py file acts as your module’s identity card. It tells Odoo everything it needs to know about your addon – its name, dependencies, category, and what data files it needs to load.

  1. Open __manifest__.py: Navigate into your newly created invoice_receipt folder and open the __manifest__.py file with your preferred code editor.
  2. Define Module Details: Update the file with the following information:
{
    'name': "Print Invoice Receipt",
    'version': '1.0',
    'depends': ['account'], # Crucial: Our report depends on Odoo's accounting module
    'author': "Your Company Name",
    'category': 'Accounting',
    'description': """
    Adds a customizable receipt report to Odoo invoices,
    providing clear payment confirmation for customers.
    """,
    'data': [], # We will populate this list in the next step
    'installable': True,
    'auto_install': False,
    'application': False,
}
  • 'name': A user-friendly name that will appear in the Odoo Apps list.
  • 'depends': This is critical. Since our receipt report is based on invoices, which are part of Odoo’s account module, we must declare account as a dependency. Without this, Odoo won’t know where to find the account.move model (the modern invoice object).
  • 'category': Helps in organizing modules within the Odoo Apps interface.
  • 'description': A brief explanation of what your module does.
  • 'data': Initially an empty list. This is where we’ll later specify our XML report definition file.
  1. Save the File: Save the __manifest__.py file.

Step 3: Defining the Odoo Invoice Receipt Report Structure with XML

This is the core of our customization. We’ll create an XML file that defines the report itself, its appearance in the “Print” menu, and the actual content of the receipt. Odoo uses QWeb, a powerful templating engine, to render these reports.

  1. Create report Folder: Inside your invoice_receipt module, create a new folder named report.
  2. Create invoice_receipt.xml: Inside the report folder, create a new XML file named invoice_receipt.xml.
  3. Add Report Definition: Paste the following XML structure into invoice_receipt.xml:
<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <data>
        <!-- 1. Action Report Definition: Makes the report available in the Print menu -->
        <report
            id="action_report_invoice_receipt"
            model="account.move"
            string="Payment Receipt"
            report_type="pdf"
            name="invoice_receipt.report_invoice_receipt_template"
            file="invoice_receipt.report_invoice_receipt_template"
            print_report_name="(object.name + '_Receipt')"
        />

        <!-- 2. Main QWeb Template (for handling multiple documents) -->
        <template id="report_invoice_receipt_template">
           <t t-call="web.html_container">
                <t t-foreach="docs" t-as="doc">
                    <!-- Calls the individual document template for each invoice -->
                    <t t-call="invoice_receipt.report_invoice_receipt_document" t-lang="doc.partner_id.lang"/>
                </t>
            </t>
        </template>

        <!-- 3. Individual Document Layout Template -->
        <template id="report_invoice_receipt_document">
            <t t-call="web.external_layout"> <!-- Uses Odoo's standard header/footer -->
                <div class="page">
                    <div class="oe_structure"/>
                    <br/>
                    <div class="row">
                        <div class="col-xs-12 text-center">
                            <h1 class="text-primary">Payment Receipt</h1>
                            <p class="lead">Thank you for your payment!</p>
                            <br/>
                        </div>
                    </div>

                    <div class="row mt32 mb32">
                        <div class="col-xs-6">
                            <strong>Received From:</strong>
                            <address t-field="doc.partner_id" t-options='{"widget": "contact", "fields": ["address", "name", "phone", "email"], "no_marker": true}'/>
                        </div>
                        <div class="col-xs-6 text-right">
                            <strong>Receipt Date:</strong>
                            <p t-field="doc.date" t-options='{"widget": "date"}'/>
                            <strong>Invoice Number:</strong>
                            <p><span t-field="doc.name"/></p>
                            <strong>Payment Status:</strong>
                            <p class="text-success">PAID</p>
                        </div>
                    </div>

                    <div class="row mt32 mb32">
                        <div class="col-xs-12">
                            <h2 class="text-center">Total Amount Paid</h2>
                            <h1 class="text-center text-success">
                                <span t-field="doc.amount_total" t-options='{"widget": "monetary", "display_currency": doc.currency_id}'/>
                            </h1>
                            <p class="text-center text-muted">For the settlement of invoice <span t-field="doc.name"/>.</p>
                        </div>
                    </div>

                    <!-- Optional: Add payment details if available -->
                    <t t-if="doc.payment_state == 'paid' and doc.invoice_payments_widget != 'false'">
                        <div class="row mt32 mb32">
                            <div class="col-xs-12">
                                <h3>Payment Details:</h3>
                                <t t-foreach="doc.invoice_payments_widget['content']" t-as="payment_line">
                                    <p>
                                        <span t-esc="payment_line.get('date')"/> -
                                        <span t-esc="payment_line.get('name')"/>:
                                        <span t-esc="payment_line.get('amount')"/>
                                        <span t-esc="doc.currency_id.symbol"/>
                                    </p>
                                </t>
                            </div>
                        </div>
                    </t>

                    <div class="row mt64 text-center">
                        <div class="col-xs-12">
                            <p>Thank you for your business!</p>
                        </div>
                    </div>
                </div>
            </t>
        </template>
    </data>
</odoo>

Deconstructing the XML for Your Odoo Invoice Receipt Report:

This XML file is divided into three crucial parts, working together to deliver a functional payment confirmation report:

  1. <report> Tag (Action Report Definition):
    • This tag registers your report with Odoo, making it accessible from the user interface.
    • id="action_report_invoice_receipt": A unique identifier for this specific action report.
    • model="account.move": Links this report to the invoice model (account.move). This is why it appears under the “Print” menu for invoices.
    • string="Payment Receipt": The label displayed in the “Print” dropdown menu.
    • report_type="pdf": Specifies that the output will be a PDF document.
    • name="invoice_receipt.report_invoice_receipt_template": This is the absolute path to the main QWeb template that Odoo will render. It follows the format module_name.template_id.
    • file="invoice_receipt.report_invoice_receipt_template": Used for the filename when downloading the generated PDF.
    • print_report_name="(object.name + '_Receipt')": Dynamically sets the PDF filename, appending “_Receipt” to the invoice number.
  2. <template id="report_invoice_receipt_template"> (Main QWeb Template):
    • This template acts as a wrapper, especially useful when printing multiple receipts from a list of invoices.
    • <t t-call="web.html_container">: A standard Odoo directive that provides the basic HTML structure for reports.
    • <t t-foreach="docs" t-as="doc">: This loop iterates through each selected invoice (docs is a list of account.move records). For each invoice, it assigns it to the doc variable.
    • <t t-call="invoice_receipt.report_invoice_receipt_document" t-lang="doc.partner_id.lang"/>: This is where the magic happens. It calls the single-document template (report_invoice_receipt_document) for each doc (invoice). The t-lang attribute is important for localization, ensuring the report is rendered in the language preferred by the customer (partner).
  3. <template id="report_invoice_receipt_document"> (Individual Document Layout):
    • This template defines the actual layout and content for a single Odoo invoice receipt report.
    • <t t-call="web.external_layout">: Crucial for consistency! This directive instructs Odoo to wrap your custom content with the standard Odoo report header and footer, including company logo, address, and page numbers. For more details on QWeb and external layouts, consult the Odoo documentation on QWeb Reports (DoFollow).
    • <div class="page">: A standard container for report content, often used with Bootstrap CSS classes (DoFollow) for responsive design and styling within Odoo reports.
    • Content Sections (<h1>, <p>, <strong>, <span>):
      • We use standard HTML tags for structuring the content.
      • QWeb Directives (t-field, t-options, t-if, t-foreach, t-esc):
        • t-field="doc.name": A powerful QWeb directive that fetches and displays the value of a field from the doc object (our current invoice). In this case, it gets the invoice number. Odoo intelligently handles various field types.
        • t-field="doc.partner_id": Displays the customer’s contact information. partner_id is a Many2one field linking to the res.partner model. The t-options attribute further customizes its display as a contact block.
        • t-field="doc.amount_total" t-options='{"widget": "monetary", "display_currency": doc.currency_id}': Displays the total amount. The t-options here formats the number as currency, using the invoice’s specified currency.
        • t-if="doc.payment_state == 'paid' and doc.invoice_payments_widget != 'false'": A conditional directive that only renders the enclosed content if the invoice status is ‘paid’ and there are payment details to show.
        • t-foreach="doc.invoice_payments_widget['content']" t-as="payment_line": Loops through the payment details available on the invoice (a special widget that holds payment info).
        • t-esc="payment_line.get('date')": Safely displays data from a dictionary, escaping any potentially harmful characters.
  1. Save the File: Save invoice_receipt.xml.

Step 4: Loading Your Report XML into the Module

Now that your report definition is complete, you need to tell Odoo’s module system to load this XML file when your invoice_receipt module is installed or updated.

  1. Re-open __manifest__.py: Go back to your invoice_receipt module’s __manifest__.py file.
  2. Update 'data' Key: Modify the 'data' list to include the path to your new XML file:
'data': [
    'report/invoice_receipt.xml', # This line tells Odoo to load your report definition
],
  1. Save the File: Save __manifest__.py.

Step 5: Installing or Upgrading Your Odoo Module

With all files in place, it’s time to bring your Odoo invoice receipt report to life within your Odoo instance.

  1. Access Odoo Apps: Log into your Odoo instance as an administrator.
  2. Activate Developer Mode: If not already active, enable “Developer Mode” (found by clicking your user icon in the top right and selecting “Activate the developer mode”). This is crucial for seeing the “Update Apps List” option.
  3. Update Apps List: Go to the “Apps” menu. Click on “Update Apps List” (it might be under a small button like “Update List” or a menu option). This scans your addons path for new modules.
  4. Install/Upgrade Your Module: Search for “Print Invoice Receipt” (or whatever name you gave your module).
    • If it’s a new module, click “Install.”
    • If you’re making changes to an already installed module, click “Upgrade.” This will apply all your XML and manifest changes.

Step 6: Testing Your New Odoo Invoice Receipt Report

The moment of truth! Let’s verify that your custom payment confirmation report is working as expected.

  1. Navigate to Invoices: Go to “Accounting” > “Customers” > “Invoices”.
  2. Select an Invoice: Open any existing invoice that has a paid status. If you don’t have one, create a new customer invoice and register a payment for it to change its status.
  3. Access the Print Menu: Click the “Print” button located at the top of the invoice form view.
  4. Find “Payment Receipt”: You should now see a new option labeled “Payment Receipt” (or whatever string you defined in your <report> tag).
  5. Generate and Verify: Click on “Payment Receipt.” Odoo will generate a PDF. Verify that:
    • The report opens correctly without errors.
    • It displays the correct customer name, invoice number, and total amount.
    • The “Payment Receipt” heading and “Thank you” message are present.
    • Any other custom fields or styling you added are rendered properly.

    If you encounter any issues, check your Odoo server logs for error messages. Common issues include incorrect field names (e.g., doc.number instead of doc.name for invoice number, depending on Odoo version), XML syntax errors, or forgetting to upgrade the module. Refer back to Step 3: Defining the Odoo Invoice Receipt Report Structure with XML for a detailed breakdown of the XML and QWeb directives.

Advanced Tips and Customization for Your Odoo Invoice Receipt Report

This tutorial provides a solid foundation. Here are ways to further enhance your custom receipt:

  • Styling with Bootstrap: Odoo’s reports are based on Bootstrap 3. You can use standard Bootstrap classes (e.g., row, col-xs-12, text-center, mt32 for margin-top 32px) directly in your QWeb templates for layout and styling.
  • Adding More Fields: Explore the account.move model in developer mode (by clicking the “bug” icon and selecting “View Fields”) to find other relevant fields you might want to include, such as payment date, payment method, or salesperson.
  • Company Information: The web.external_layout automatically includes company details. If you need to customize them, you can often inherit and modify that base layout, though it’s more advanced.
  • Conditional Rendering: Use t-if directives to show or hide parts of the report based on specific conditions (e.g., only show payment method if available).
  • Multi-company Support: Ensure your report handles multi-company environments correctly by always referencing doc.company_id for company-specific data.

Conclusion

You’ve now successfully created a custom Odoo invoice receipt report, a powerful addition to your Odoo accounting toolkit. By following these three essential steps—creating a module, configuring its manifest, and defining the report with QWeb XML—you’ve not only added a valuable feature but also gained a deeper understanding of Odoo’s robust customization capabilities.

This personalized payment confirmation report will undoubtedly boost your operational efficiency, improve client communication, and solidify your business’s professional image. Embrace the flexibility of Odoo and continue exploring its potential to tailor the system to your exact needs. Happy reporting!


Discover more from teguhteja.id

Subscribe to get the latest posts sent to your email.

1 thought on “Unleash the Ultimate Odoo Invoice Receipt Report: 3 Essential Steps”

  1. Pingback: Amazing 5 Odoo 18 Invoice Management Tips

Leave a Reply

WP Twitter Auto Publish Powered By : XYZScripts.com