Files
suite/hr_payroll_slip_ytd/views/payslip_views.xml
2021-03-26 10:53:02 -05:00

43 lines
2.1 KiB
XML

<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<template id="report_payslip_inherit" name="Payslip YTD" inherit_id="hr_payroll.report_payslip">
<!-- Add YTD to basic salary summary -->
<xpath expr="//table[3]/tr" position="inside">
<t t-set="ytd" t-value="o.ytd('BASIC', allow_draft=True)"/>
<td><strong>YTD</strong></td>
<td><span t-esc="ytd.get('total', 0.0)" t-options="{&quot;widget&quot;: &quot;monetary&quot;, &quot;display_currency&quot;: o.company_id.currency_id}"/></td>
</xpath>
<!-- Add YTD to the table head-->
<xpath expr="//table[4]/thead/tr//th[last()]" position="after">
<th>Total</th>
<th>YTD Quantity</th>
<th>YTD Amount</th>
<th>YTD Total</th>
</xpath>
<!-- Add YTD worked days data -->
<xpath expr="//table[4]/tbody/tr[1]/td[last()]" position="after">
<t t-set="worked_ytd" t-value="o.worked_ytd(worked_days.code, allow_draft=True)"/>
<td/>
<td/>
<td><span t-esc="worked_ytd.get('amount', 0.0)" t-options="{&quot;widget&quot;: &quot;monetary&quot;, &quot;display_currency&quot;: o.company_id.currency_id}"/></td>
<td/>
</xpath>
<!-- Re-add column for line amount -->
<xpath expr="//table[4]/tbody/tr[2]/td[last()]" position="before">
<td><span t-esc="line.amount"
t-options='{"widget": "monetary", "display_currency": o.company_id.currency_id}'/></td>
</xpath>
<!-- Add YTD table data-->
<xpath expr="//table[4]/tbody/tr[2]/td[last()]" position="after">
<t t-set="ytd" t-value="o.ytd(line.code, allow_draft=True)"/>
<td><span t-esc="ytd.get('quantity', 0.0)"/></td>
<td><span t-esc="ytd.get('amount', 0.0)" t-options="{&quot;widget&quot;: &quot;monetary&quot;, &quot;display_currency&quot;: o.company_id.currency_id}"/></td>
<td><span t-esc="ytd.get('total', 0.0)" t-options="{&quot;widget&quot;: &quot;monetary&quot;, &quot;display_currency&quot;: o.company_id.currency_id}"/></td>
</xpath>
</template>
</odoo>