Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Create a report for the Session model in Odoo9

    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 484
    Comment on it

    If you want to create a report for the Session mode follow the below code in your Odoo module. And for each session, it should display session's name, its start and end, and list the session's attendees.

    1. openacademy/__openerp__.py
    2. 'views/openacademy.xml',
    3. 'views/partner.xml',
    4. 'views/session_workflow.xml',
    5. 'reports.xml',
    6. ],
    7. # only loaded in demonstration mode
    8. 'demo': [
    9. openacademy/reports.xml
    10. <openerp>
    11. <data>
    12. <report id="report_session" model="openacademy.session" string="Session Report" name="openacademy.report_session_view" file="openacademy.report_session" report_type="qweb-pdf">
    13.  
    14. <template id="report_session_view">
    15. <t t-call="report.html_container">
    16. <t t-foreach="docs" t-as="doc">
    17. <t t-call="report.external_layout">
    18. <div class="page">
    19. <h2 t-field="doc.name"/>
    20. <p>From <span t-field="doc.start_date"/> to <span t-field="doc.end_date"/></p>
    21. <h3>Attendees:</h3>
    22. <ul>
    23. <t t-foreach="doc.attendee_ids" t-as="attendee">
    24. <li><span t-field="attendee.name"/></li>
    25. </t>
    26. </ul>
    27. </div>
    28. </t>
    29. </t>
    30. </t>
    31. </template>
    32. </report></data></openerp>

    Note- If you noticed that the PDF report is missing the styles means the text appears but the style/layout is different from the html version, then it is possible that your wkhtmltopdf process couldn't reach to the web server to download them.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Reset Password
Fill out the form below and reset your password: