[MIG] hr_payroll_slip_ytd: migrate to 14.0

H4817
This commit is contained in:
Cedric Collins
2021-03-31 13:59:40 -05:00
committed by Leo Pinedo
parent 57062d4318
commit 3a0abfffa3
2 changed files with 14 additions and 6 deletions

View File

@@ -1,7 +1,7 @@
{ {
'name': 'Payroll Report Year to Date', 'name': 'Payroll Report Year to Date',
'author': 'Hibou Corp. <hello@hibou.io>', 'author': 'Hibou Corp. <hello@hibou.io>',
'version': '13.0.1.1.0', 'version': '14.0.1.1.0',
'category': 'Human Resources', 'category': 'Human Resources',
'sequence': 95, 'sequence': 95,
'summary': 'Show YTD computations on Payslip Report', 'summary': 'Show YTD computations on Payslip Report',

View File

@@ -2,14 +2,22 @@
<odoo> <odoo>
<template id="report_payslip_inherit" name="Payslip YTD" inherit_id="hr_payroll.report_payslip"> <template id="report_payslip_inherit" name="Payslip YTD" inherit_id="hr_payroll.report_payslip">
<!-- Add YTD to basic salary summary --> <!-- Add YTD to basic salary summary -->
<xpath expr="//table[3]/tr" position="inside"> <xpath expr="//table[2]/tr" position="inside">
<t t-set="ytd" t-value="o.ytd('BASIC', allow_draft=True)"/> <t t-set="ytd" t-value="o.ytd('BASIC', allow_draft=True)"/>
<td><strong>YTD</strong></td> <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> <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> </xpath>
<!-- Revert the way quantity is represented on the payslip -->
<xpath expr="//div[@id='total']/table/thead/tr//th[3]" position="replace">
<th>Quantity/Number of Days</th>
</xpath>
<xpath expr="//div[@id='total']/table/tbody/span[2]//td[3]/span" position="attributes">
<attribute name="t-if"/>
</xpath>
<!-- Add YTD to the table head--> <!-- Add YTD to the table head-->
<xpath expr="//table[4]/thead/tr//th[last()]" position="after"> <xpath expr="//div[@id='total']/table/thead/tr//th[last()]" position="after">
<th>Total</th> <th>Total</th>
<th>YTD Quantity</th> <th>YTD Quantity</th>
<th>YTD Amount</th> <th>YTD Amount</th>
@@ -18,7 +26,7 @@
<!-- Add YTD worked days data --> <!-- Add YTD worked days data -->
<xpath expr="//table[4]/tbody/tr[1]/td[last()]" position="after"> <xpath expr="//div[@id='total']/table/tbody/span[1]//td[last()]" position="after">
<t t-set="worked_ytd" t-value="o.worked_ytd(worked_days.code, allow_draft=True)"/> <t t-set="worked_ytd" t-value="o.worked_ytd(worked_days.code, allow_draft=True)"/>
<td/> <td/>
<td/> <td/>
@@ -27,13 +35,13 @@
</xpath> </xpath>
<!-- Re-add column for line amount --> <!-- Re-add column for line amount -->
<xpath expr="//table[4]/tbody/tr[2]/td[last()]" position="before"> <xpath expr="//div[@id='total']/table/tbody/span[2]//td[last()]" position="before">
<td><span t-esc="line.amount" <td><span t-esc="line.amount"
t-options='{"widget": "monetary", "display_currency": o.company_id.currency_id}'/></td> t-options='{"widget": "monetary", "display_currency": o.company_id.currency_id}'/></td>
</xpath> </xpath>
<!-- Add YTD table data--> <!-- Add YTD table data-->
<xpath expr="//table[4]/tbody/tr[2]/td[last()]" position="after"> <xpath expr="//div[@id='total']/table/tbody/span[2]//td[last()]" position="after">
<t t-set="ytd" t-value="o.ytd(line.code, allow_draft=True)"/> <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('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('amount', 0.0)" t-options="{&quot;widget&quot;: &quot;monetary&quot;, &quot;display_currency&quot;: o.company_id.currency_id}"/></td>