<odoo>
    <!-- Mail template are declared in a NOUPDATE block
         so users can freely customize/delete them -->
    <data noupdate="1">
        <!-- Email template -->
        <record id="mail_template_hr_payslip" model="mail.template">
            <field name="name">Send payslip by email</field>
            <field name="model_id" ref="payroll.model_hr_payslip" />
            <field name="email_from">{{user.employee_id.work_email}}</field>
            <field name="email_to">{{object.employee_id.address_home_id.email}}</field>
            <field name="reply_to">{{user.employee_id.work_email}}</field>
            <field
                name="subject"
            >Payslip for {{object.payslip_run_id.name}} from {{object.company_id.name}}</field>
            <field name="body_html" type="html">
    <div style="margin: 0px; padding: 0px;">
        <p style="margin: 0px; padding: 0px; font-size: 13px;">
            Dear <t t-out="object.employee_id.name" />,
            <br /><br />
            Please find attached the payslip for <t
                            t-out="object.payslip_run_id.name"
                        />.
            <br /><br />
            Do not hesitate to contact us if you have any questions.
            <br /><br />
            <t t-out="user.signature" />
        </p>
    </div>
            </field>
            <field name="report_template" ref="payroll.action_report_payslip" />
            <field name="lang">{{object.employee_id.address_home_id.lang}}</field>
            <field name="auto_delete" eval="True" />
        </record>
    </data>

    <data>
        <record id="action_partner_mass_mail" model="ir.actions.act_window">
            <field name="name">Send email with payslip</field>
            <field name="res_model">mail.compose.message</field>
            <field name="view_mode">form</field>
            <field name="target">new</field>
            <field
                name="context"
                eval="{
                'default_composition_mode': 'mass_mail',
                'default_use_template': True,
                'default_template_id': ref('payroll.mail_template_hr_payslip'),
            }"
            />
            <field name="binding_model_id" ref="payroll.model_hr_payslip" />
            <field name="binding_view_types">list</field>
        </record>
    </data>
</odoo>
