Welcome!

Share and discuss the best content and new marketing ideas, build your professional profile and become a better marketer together.

Sign up

You need to be registered to interact with the community.
This question has been flagged
1 Reply
47 Views

Hey Cyllo community! Anyone know how to customize the PDF report for sales orders? Looking to add a logo and maybe rearrange some fields. Any tips or tutorials would be awesome!

Avatar
Discard

Here's how you can create a report in Odoo by defining a report template in XML, configuring a report action to link the template with the model, and implementing an abstract report model in Python. This approach ensures clean separation of concerns and maintainability.
 XML code - Report Template 'report_example_template.xml'

   

       

           

               

                   

Example Report

                   

Name:

                   

Description:

                   

Date:

               

           

       

   


XML code - Report Action ('report_actions.xml')

 

    Example Report

    example.report.wizard

    qweb-pdf

    your_module.report_example_document

    your_module.report_example_document

   

    report

 



Python code - Model (example_report_wizard.py)

from odoo import api, models


class ReportExampleDocument(models.AbstractModel):

    _name = 'report.your_module.report_example_document'


    @api.model

    def _get_report_values(self, docids, data=None):

        docs = self.env['example.model'].browse(docids)

        return {

            'doc_ids': docids,

            'doc_model': 'example.model',

            'docs': docs,

            'data': data,

        }
 Remember to replace "your_module" with the actual name of your Odoo module and "example.model" with the name of the model your report will use. Also ensure that 'model_example_report_wizard' correctly references your wizard model.

Avatar
Discard

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!