<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <!-- Used to change the format of pdf. -->
    <record id="paperformat_card" model="report.paperformat">
        <field name="name">Custom Paper</field>
        <field name="default" eval="True"/>
        <field name="format">custom</field>
        <field name="page_height">85</field>
        <field name="page_width">54</field>
        <field name="orientation">Landscape</field>
        <field name="margin_top">0</field>
        <field name="margin_bottom">0</field>
        <field name="margin_left">0</field>
        <field name="margin_right">0</field>
        <field name="header_line" eval="False"/>
        <field name="header_spacing">0</field>
        <field name="dpi">300</field>
    </record>
    <!--Report Action-->
    <record id="action_membership_card" model="ir.actions.report">
        <field name="name">Membership Card</field>
        <field name="model">res.partner</field>
        <field name="report_type">qweb-pdf</field>
        <field name="report_name">membership_card_odoo.print_member_ship_card</field>
        <field name="report_file">membership_card_odoo.print_member_ship_card</field>
        <field name="paperformat_id"
               ref="membership_card_odoo.paperformat_card"/>
    </record>
    <!--     Template to print Pdf. -->
    <template id="print_member_ship_card">
        <t t-call="web.html_container">
            <!-- Header -->
            <div t-attf-style="background-image: url('#{background_src}');background-size: 100% 100%; background-repeat: no-repeat; background-position: 0 0; height: 280mm; width: 450mm;" class="page">
                <div>
                    <div t-if="name"
                         style="position: absolute; top: 70mm; right: 160mm; font-size: 60px; font-weight: bold; text-align: right; direction: rtl;">
                        <t t-esc="name"/>
                    </div>
                    <div t-if="membrship_no"
                         style="position: absolute; top: 95mm; right: 160mm; font-size: 60px; font-weight: bold; text-align: right; direction: rtl;">
                        <t t-esc="membrship_no"/>
                    </div>
                    <div t-if="start_date"
                         style="position: absolute; top: 120mm; right: 160mm; font-size: 60px; font-weight: bold; text-align: right; direction: rtl;">
                        <t t-esc="start_date"/>
                    </div>
                    <div t-if="end_date"
                         style="position: absolute; top: 145mm; right: 160mm; font-size: 60px; font-weight: bold; text-align: right; direction: rtl;">
                        <t t-esc="end_date"/>
                    </div>
                </div>
            </div>
        </t>
    </template>

</odoo>
