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
    • 433
    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.

    openacademy/__openerp__.py
            'views/openacademy.xml',
            'views/partner.xml',
            'views/session_workflow.xml',
            'reports.xml',
        ],
        # only loaded in demonstration mode
        'demo': [
    openacademy/reports.xml
    <openerp>
    <data>
        <report id="report_session" model="openacademy.session" string="Session Report" name="openacademy.report_session_view" file="openacademy.report_session" report_type="qweb-pdf">
    
    <template id="report_session_view">
        <t t-call="report.html_container">
            <t t-foreach="docs" t-as="doc">
                <t t-call="report.external_layout">
                    <div class="page">
                        <h2 t-field="doc.name"/>
                        <p>From <span t-field="doc.start_date"/> to <span t-field="doc.end_date"/></p>
                        <h3>Attendees:</h3>
                        <ul>
                            <t t-foreach="doc.attendee_ids" t-as="attendee">
                                <li><span t-field="attendee.name"/></li>
                            </t>
                        </ul>
                    </div>
                </t>
            </t>
        </t>
    </template>
    </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
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: