Tuesday, January 28, 2020

design report in odoo

ODOO

reports

 
In this step we will show how to design report bellow 


You can design this report by adding the template bellow 

<?xml version="1.0" encoding="utf-8" ?>
<odoo>

        <!-- ...Define Template... -->

        <template id="booking_custom_report_temp">
            <t t-call="web.html_container">
                <t t-call="web.external_layout">
                    <div class="page">
                        <header>
                            <div style="float:left;border-bottom: 2px solid black;border-color:#1f7b91 ! important;width:70%;">
                                <b style="font-size:32px;color:#1f7b91 ! important;">
                                    Shilal Software Company
                                </b>
                                <br></br>
                                <b style="font-size:22px;color:#1f7b91 !important;">
                                    Clinic Managment System
                                </b>
                            </div>
                            <div style="float:right;">
                                <!-- <img src=\"/logo.png?company=${company.id}\"/> -->
                                <img src="/clinic/static/img/shilal.png" style="width:160px;height:100px;"/>
                            </div>
                        </header>
                        <br></br><br></br><br></br><br></br><br></br><br></br><br></br>
                        <div>
                            <center>
                                <u>
                                    <b style="font-size:20px;">
                                        Clinic Booking Report
                                    </b>
                                </u>
                            </center>
                        </div>
                        <br></br><br></br>
                        <div style="width:50%;float:left;font-size:14;">
                            <t t-if="doctor_id != 'no'">
                                <b>
                                    Doctor :
                                </b>
                                <span t-esc="doctor_id" />
                                <br></br>
                            </t>
                            <t t-if="patient_id != 'no'">
                                <b>
                                    Patient :
                                </b>
                                <span t-esc="patient_id" />
                                <br></br>
                            </t>
                            <t t-if="meeting_date != 'no'">
                                <b>
                                    Meeting Date :
                                </b>
                                <span t-esc="meeting_date" />
                                <br></br>
                            </t>
                            <br></br>
                        </div>
                        <div style="width:50%;float:right;font-size:14;">
                            <t t-if="date != 'no'">
                                <b>
                                    Date :
                                </b>
                                <span t-esc="date" />
                                <br></br>
                            </t>
                            <t t-if="state != 'no'">
                                <b>
                                    State :
                                </b>
                                <span t-esc="state" />
                                <br></br>
                            </t>
                        </div>
                        <table style="width:100%;">
                            <tr style="font-size:18px; border: 2px solid black;text-align: center;background-color:#d6d6c2 !important;">
                                <td style="font-size:14px; border: 2px solid black;padding-top:5px;padding-bottom:5px;">
                                    <b>
                                        Doctor
                                    </b>
                                </td>
                                <td style="font-size:14px; border: 2px solid black;padding-top:5px;padding-bottom:5px;">
                                    <b>
                                        Paient
                                    </b>
                                </td>
                                <td style="font-size:14px; border: 2px solid black;padding-top:5px;padding-bottom:5px;">
                                    <b>
                                        Booking Date
                                    </b>
                                </td>
                                <td style="font-size:14px; border: 2px solid black;padding-top:5px;padding-bottom:5px;">
                                    <b>
                                        Meeting Date
                                    </b>
                                </td>
                                <td style="font-size:14px; border: 2px solid black;padding-top:5px;padding-bottom:5px;">
                                    <b>
                                        State
                                    </b>
                                </td>
                            </tr>
                            <t t-foreach="data" t-as="object_line">
                                <tr style="font-size:18px; border: 2px solid black;text-align: center;">
                                    <td style="font-size:14px; border: 2px solid black;padding-top:5px;padding-bottom:5px;">
                                        <n>
                                            <span t-esc="object_line.doctor_id.name" />
                                        </n>
                                    </td>
                                    <td style="font-size:14px; border: 2px solid black;padding-top:5px;padding-bottom:5px;">
                                        <n>
                                            <span t-esc="object_line.patient_id.name" />
                                        </n>
                                    </td>
                                    <td style="font-size:14px; border: 2px solid black;padding-top:5px;padding-bottom:5px;">
                                        <n>
                                            <span t-esc="object_line.date" />
                                        </n>
                                    </td>
                                    <td style="font-size:14px; border: 2px solid black;padding-top:5px;padding-bottom:5px;">
                                        <n>
                                            <span t-esc="object_line.meeting_date" />
                                        </n>
                                    </td>
                                    <td style="font-size:14px; border: 2px solid black;padding-top:5px;padding-bottom:5px;">
                                        <n>
                                            <span t-esc="object_line.state" />
                                        </n>
                                    </td>
                                </tr>
                            </t>
                        </table>
                        <br></br><br></br>
                        <div>
                            <b style="font-size:14px;width:50%;float:left;">
                                Print By : <span t-esc="request.env.user.partner_id.name" />
                                <br></br>
                                Signiture : _____________________________
                            </b>
                        </div>
                        <div>
                            <b style="font-size:14px;width:50%;float:right;">
                                Print On : <span t-esc="context_timestamp(datetime.datetime.now()).strftime('%A %d-%B-%Y')"/>
                            </b>
                        </div>
                    </div>
                </t>
            </t>
        </template>

        <!-- """create report """ -->

        <report
            id="booking_custom_report_action"
            string="Booking Report"
            model="clinic.booking"
            report_type="qweb-pdf"
            name="clinic.booking_custom_report_temp"
            menu="False"
        />
         <record id="paperformat_euro_no_margin" model="report.paperformat">
            <field name="name">European A5</field>
            <field name="default" eval="True" />
            <field name="format">A4</field>
            <field name="page_height">0</field>
            <field name="page_width">0</field>
            <field name="orientation">Portrait</field>
            <field name="margin_top">5</field>
            <field name="margin_bottom">5</field>
            <field name="margin_left">7</field>
            <field name="margin_right">7</field>
            <field name="header_line" eval="False" />
            <field name="header_spacing">0</field>
            <field name="dpi">90</field>
        </record>

</odoo>



PREVIOUS STEP            NEXT STEP

No comments:

Post a Comment

Odoo Invoice Qr code issues

There are two main issues must of us facing with the QR code in Odoo invoice & these issues are 1/ QR code displayed as broken image w...