{"id":18982,"date":"2024-10-16T06:21:46","date_gmt":"2024-10-16T06:21:46","guid":{"rendered":"https:\/\/www.infinitivehost.com\/blog\/?p=18982"},"modified":"2024-10-16T06:21:48","modified_gmt":"2024-10-16T06:21:48","slug":"add-a-pdf-report-download-button-to-odoo-17-customer-portal","status":"publish","type":"post","link":"https:\/\/www.infinitivehost.com\/blog\/add-a-pdf-report-download-button-to-odoo-17-customer-portal\/","title":{"rendered":"Add a PDF Report Download Button to Odoo..."},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">In the rapidly evolving world, customer portals work as necessary touchpoints, allowing customers to use their information, download files, and involve themselves with online businesses. Odoo 17 Customer Portal is a very reliable tool, and including a button for PDF report download makes it very beneficial for clients. This feature allows customers to rapidly download important documents, enhancing the customer experience and productivity. Even though it\u2019s invoices, purchase order records, or statements, the PDF download button improves the availability of your customer portal.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this guide, we will simply go through several crucial steps to easily add a PDF report download button to the Customer Portal of Odoo 17. We will also talk about how selecting the appropriate Odoo Hosting Solution can increase your customer\u2019s portal performance. Infinitive Host offers the best Odoo solutions to benefit all organizations, backed by superior-performance GPU server proficiencies for seamless, quick, and successful portal access.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Why Add a PDF Report Download Button?<\/strong><\/h2>\n\n\n\n<figure class=\"wp-block-image size-full\"><img fetchpriority=\"high\" decoding=\"async\" width=\"768\" height=\"288\" src=\"https:\/\/www.infinitivehost.com\/blog\/wp-content\/uploads\/2024\/10\/Why-Add-a-PDF-Report-Download-Button.webp\" alt=\"Why Add a PDF Report Download Button\" class=\"wp-image-18983\" srcset=\"https:\/\/www.infinitivehost.com\/blog\/wp-content\/uploads\/2024\/10\/Why-Add-a-PDF-Report-Download-Button.webp 768w, https:\/\/www.infinitivehost.com\/blog\/wp-content\/uploads\/2024\/10\/Why-Add-a-PDF-Report-Download-Button-300x113.webp 300w, https:\/\/www.infinitivehost.com\/blog\/wp-content\/uploads\/2024\/10\/Why-Add-a-PDF-Report-Download-Button-480x180.webp 480w\" sizes=\"(max-width: 768px) 100vw, 768px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The integration of this button increases interaction with clients and portal usage by providing proper access to all crucial documents. Here are several advantages of it:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Improved Accessibility<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Customers can easily download and save files easily from the customer portal, saving crucial time and decreasing the requirement for email follow-ups.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Enhanced User Experience<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">A smooth download experience remains clients fully satisfied, as they can handle their information and use data as per demand.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Automated Workflow<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">By offering the PDF option in the customer portal, you can easily decrease the workload on your employees, as customers don\u2019t want to request documents manually.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Constant Branding<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The PDF format lets you uphold constant branding among all client-facing reports.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Conditions for Adding a PDF Download Button<\/strong><\/h2>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"768\" height=\"288\" src=\"https:\/\/www.infinitivehost.com\/blog\/wp-content\/uploads\/2024\/10\/Conditions-for-Adding-a-PDF-Download-Button.webp\" alt=\"Conditions for Adding a PDF Download Button\" class=\"wp-image-18984\" srcset=\"https:\/\/www.infinitivehost.com\/blog\/wp-content\/uploads\/2024\/10\/Conditions-for-Adding-a-PDF-Download-Button.webp 768w, https:\/\/www.infinitivehost.com\/blog\/wp-content\/uploads\/2024\/10\/Conditions-for-Adding-a-PDF-Download-Button-300x113.webp 300w, https:\/\/www.infinitivehost.com\/blog\/wp-content\/uploads\/2024\/10\/Conditions-for-Adding-a-PDF-Download-Button-480x180.webp 480w\" sizes=\"(max-width: 768px) 100vw, 768px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Before adding the PDF report download button, you must make sure that you have:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Odoo 17 Installed<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Ensure you are currently working on Odoo 17.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Developer Access<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Developer mode should be allowed to use the crucial tools.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Server Resources<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Since producing and downloading PDF files can be very resource-intensive, a powerful Odoo Server Solution is suggested. Infinitive Host provides optimal performance and the best Odoo solutions enhanced for organizations with demanding requirements.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Comprehensive Guide to Adding a PDF Report Download Button<\/strong><\/h2>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"768\" height=\"288\" src=\"https:\/\/www.infinitivehost.com\/blog\/wp-content\/uploads\/2024\/10\/Comprehensive-Guide-to-Adding-a-PDF-Report-Download.webp\" alt=\"Comprehensive Guide to Adding a PDF Report Download Button\" class=\"wp-image-18985\" srcset=\"https:\/\/www.infinitivehost.com\/blog\/wp-content\/uploads\/2024\/10\/Comprehensive-Guide-to-Adding-a-PDF-Report-Download.webp 768w, https:\/\/www.infinitivehost.com\/blog\/wp-content\/uploads\/2024\/10\/Comprehensive-Guide-to-Adding-a-PDF-Report-Download-300x113.webp 300w, https:\/\/www.infinitivehost.com\/blog\/wp-content\/uploads\/2024\/10\/Comprehensive-Guide-to-Adding-a-PDF-Report-Download-480x180.webp 480w\" sizes=\"(max-width: 768px) 100vw, 768px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Here\u2019s a complete guide to adding a PDF download button to the Customer Portal of Odoo 17:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 1: Enable Developer Mode<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">To begin, simply log in to Odoo with any admin account, then go to the Settings<strong> <\/strong>option and enable <strong>Developer Mode<\/strong>. This gives permission to all the technical settings that are needed to add the button.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 2: Create a Custom PDF Report Template<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Odoo lets you create custom PDF report templates in the format HTML, which it then transforms into PDFs. You can now easily create a new report template that consists of the data that your customers want:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Direct to <strong>Technical<\/strong> then <strong>Reports<\/strong> and then go to <strong>Report Templates<\/strong>.<\/li>\n\n\n\n<li>Click on <strong>Create<\/strong> to build a new template option for creating the report template.<\/li>\n\n\n\n<li>Add all important fields and edit them according to the type of document that you choose (for example, a sales order, a statement, or others).<\/li>\n\n\n\n<li>Save and then properly test the created template to ensure it renders appropriately as a PDF.<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 3: Configure the Report Action<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">After the creation of the template, configure the report action to make it easily accessible in the customer portal.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Go to <strong>Technical<\/strong>, then choose <strong>Actions<\/strong>, and go to <strong>Reports<\/strong>.<\/li>\n\n\n\n<li>Locate your created template, or develop a new report action if there is no one available.<\/li>\n\n\n\n<li>In the section of report configuration, set the <strong>Type<\/strong> of document to <strong>PDF<\/strong> and make sure that it\u2019s marked as <strong>Available in the Portal<\/strong>.<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 4: Add a Download Button in the Portal View<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Now that the custom template is properly configured, the further step is to create and add a download button in the portal:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Access the Portal view by simply going to <strong>Technical<\/strong>, then <strong>User Interface<\/strong>, and here selecting the <strong>Views option<\/strong>.<\/li>\n\n\n\n<li>Locate the correct view for the document type you need to add on the button to (example, portal_order_page for sales).<\/li>\n\n\n\n<li>Edit the XML of the chosen view and then add a download button element with an action to direct the PDF download.<\/li>\n<\/ol>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Example code snippet:<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\"><code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">&lt;t t-call=\"your_custom_module.portal_pdf_download\"><\/mark><\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0\u00a0\u00a0\u00a0<code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">&lt;button type=\"object\" name=\"download_pdf_report\" string=\"Download PDF\" class=\"btn btn-primary\"\/><\/mark><\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">&lt;\/t><\/mark><\/code><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 5: Define the Download Action in the Controller<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">In your file of the custom module\u2019s controller, simply define the download action for the PDF download button. This specific action fetches all important information from the model, creates the PDF with the help of a report template, and then sends it to the chosen browser for download.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Example Python code snippet:<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\"><code>from odoo import http<\/code><\/mark><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\"><code>from odoo.http import request<\/code><\/mark><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">class PortalCustom(http.Controller):<\/mark><\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0\u00a0\u00a0\u00a0<code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">@http.route('\/my\/report\/download', type='http', auth='user', website=True)<\/mark><\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0\u00a0\u00a0\u00a0<code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">def download_pdf_report(self, **kwargs):<\/mark><\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">\u00a0<code>record_id = kwargs.get('id')<\/code><\/mark><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">pdf = request.env.ref('module_name.report_template_id').sudo().render_qweb_pdf([record_id])[0]<\/mark><\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">\u00a0<code>pdfhttpheaders = [('Content-Type', 'application\/pdf'), ('Content-Length', len(pdf))]<\/code><\/mark><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<code>\u00a0<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">return request.make_response(pdf, headers=pdfhttpheaders)<\/mark><\/code><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 6: Test the Button<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Log in to the portal with any test account to check the working of the download button. Open the appropriate document and then click the PDF download button to download it. If everything is working properly, the PDF should download without any interruption.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Enhancing Odoo\u2019s Performance with the Best Hosting Solution<\/strong><\/h2>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"768\" height=\"288\" src=\"https:\/\/www.infinitivehost.com\/blog\/wp-content\/uploads\/2024\/10\/Enhancing-Odoos-Performance-with-the-Best-Hosting-Solution.webp\" alt=\"Enhancing Odoo\u2019s Performance with the Best Hosting Solution\" class=\"wp-image-18986\" srcset=\"https:\/\/www.infinitivehost.com\/blog\/wp-content\/uploads\/2024\/10\/Enhancing-Odoos-Performance-with-the-Best-Hosting-Solution.webp 768w, https:\/\/www.infinitivehost.com\/blog\/wp-content\/uploads\/2024\/10\/Enhancing-Odoos-Performance-with-the-Best-Hosting-Solution-300x113.webp 300w, https:\/\/www.infinitivehost.com\/blog\/wp-content\/uploads\/2024\/10\/Enhancing-Odoos-Performance-with-the-Best-Hosting-Solution-480x180.webp 480w\" sizes=\"(max-width: 768px) 100vw, 768px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>GPU Dedicated Servers<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Infinitive Host offers GPU dedicated servers for enhanced processing power, decreasing the loading time and providing proper report generation.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Managed Odoo Solutions<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Infinitive Host provides the best Odoo solutions that manage all updates, timely data backups, and maintenance to keep your system safe and enhanced.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Improved Security<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Infinitive Host offers top-tier security features, safeguarding personal information in accordance with industry rules.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Tips for Successful Document Management in Odoo<\/strong><\/h2>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"768\" height=\"288\" src=\"https:\/\/www.infinitivehost.com\/blog\/wp-content\/uploads\/2024\/10\/Tips-for-Successful-Document-Management-in-Odoo.webp\" alt=\"Tips for Successful Document Management in Odoo\" class=\"wp-image-18987\" srcset=\"https:\/\/www.infinitivehost.com\/blog\/wp-content\/uploads\/2024\/10\/Tips-for-Successful-Document-Management-in-Odoo.webp 768w, https:\/\/www.infinitivehost.com\/blog\/wp-content\/uploads\/2024\/10\/Tips-for-Successful-Document-Management-in-Odoo-300x113.webp 300w, https:\/\/www.infinitivehost.com\/blog\/wp-content\/uploads\/2024\/10\/Tips-for-Successful-Document-Management-in-Odoo-480x180.webp 480w\" sizes=\"(max-width: 768px) 100vw, 768px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">To further enhance document management inside Odoo:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Apply Role-Based Access<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Restrict customer portal access to only some particular documents according to user roles.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Automate PDF Generation<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Configure automated workflows that produce PDF documents at necessary steps, like order confirmation, or others.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Backup Regularly<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Ensure backups on time of your Odoo documents and database, including created PDF documents, to avoid any type of information loss.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Why Infinitive Host for Your Odoo Needs?<\/strong><\/h2>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"768\" height=\"288\" src=\"https:\/\/www.infinitivehost.com\/blog\/wp-content\/uploads\/2024\/10\/Why-Infinitive-Host-for-Your-Odoo-Needs.webp\" alt=\"Why Infinitive Host for Your Odoo Needs\" class=\"wp-image-18988\" srcset=\"https:\/\/www.infinitivehost.com\/blog\/wp-content\/uploads\/2024\/10\/Why-Infinitive-Host-for-Your-Odoo-Needs.webp 768w, https:\/\/www.infinitivehost.com\/blog\/wp-content\/uploads\/2024\/10\/Why-Infinitive-Host-for-Your-Odoo-Needs-300x113.webp 300w, https:\/\/www.infinitivehost.com\/blog\/wp-content\/uploads\/2024\/10\/Why-Infinitive-Host-for-Your-Odoo-Needs-480x180.webp 480w\" sizes=\"(max-width: 768px) 100vw, 768px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Infinitive Host offers optimal performance, trustworthy Odoo server solutions that benefit organizations to handle client information, workflows, and document creation with full comfort. Their managed Odoo server solutions cater to organizations requiring quick, safe, and GPU-powered servers, making them one of the best options for Odoo solutions.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Conclusion<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">In the customer portal of Odoo 17, adding a PDF download button provides more convenience to clients and simplifies document usage. For seamless working, Infinitive Host\u2019s powerful <a href=\"https:\/\/www.infinitivehost.com\/managed-odoo-server-solutions\"><mark style=\"background-color:#8ed1fc\" class=\"has-inline-color\"><strong>Odoo server solutions<\/strong><\/mark><\/a> with dedicated GPUs ensure quick, optimal, and proper customer portal working. With the appropriate Odoo hosting, cutting-edge features in Odoo are very simple to apply, boosting user experience and efficiency.<\/p>\n","protected":false},"excerpt":{"rendered":"<p><span class=\"elementor-category-label\"><a href=\"https:\/\/www.infinitivehost.com\/blog\/category\/odoo\/\">Odoo<\/a><\/span>In the rapidly evolving world, customer portals work as necessary touchpoints, allowing customers to use their information, download files, and involve themselves with online businesses. Odoo 17 Customer Portal is a very reliable tool, and including a button for PDF report download makes it very beneficial for clients. This feature allows customers to rapidly download [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":18989,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[313],"tags":[],"class_list":["post-18982","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-odoo"],"_links":{"self":[{"href":"https:\/\/www.infinitivehost.com\/blog\/wp-json\/wp\/v2\/posts\/18982","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.infinitivehost.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.infinitivehost.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.infinitivehost.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.infinitivehost.com\/blog\/wp-json\/wp\/v2\/comments?post=18982"}],"version-history":[{"count":0,"href":"https:\/\/www.infinitivehost.com\/blog\/wp-json\/wp\/v2\/posts\/18982\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.infinitivehost.com\/blog\/wp-json\/wp\/v2\/media\/18989"}],"wp:attachment":[{"href":"https:\/\/www.infinitivehost.com\/blog\/wp-json\/wp\/v2\/media?parent=18982"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.infinitivehost.com\/blog\/wp-json\/wp\/v2\/categories?post=18982"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.infinitivehost.com\/blog\/wp-json\/wp\/v2\/tags?post=18982"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}