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!
Welcome!
Share and discuss the best content and new marketing ideas, build your professional profile and become a better marketer together.
This question has been flagged
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.