MIG hr_payroll_slip_ytd to 12.0

This commit is contained in:
Jared Kipe
2019-05-20 16:06:24 -07:00
parent 6c3b77472f
commit 05a81fd209
3 changed files with 5 additions and 5 deletions

View File

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

View File

@@ -6,7 +6,7 @@ class Payslip(models.Model):
def ytd(self, code, allow_draft=False):
to_date = self.date_to
from_date = self.date_to[:4] + '-01-01'
from_date = str(self.date_to.year) + '-01-01'
state_allowed = ('done', 'verify') if not allow_draft else ('done', 'verify', 'draft')
self.env.cr.execute("""
SELECT sum(total) as sum

View File

@@ -2,13 +2,13 @@
<odoo>
<template id="report_payslip_inherit" name="Payslip YTD" inherit_id="hr_payroll.report_payslip">
<!-- Add YTD to the table head-->
<xpath expr="//table[@class='table table-condensed']/thead/tr//th[last()]" position="after">
<xpath expr="//table[2]/thead/tr//th[last()]" position="after">
<th>YTD</th>
</xpath>
<!-- Add YTD table data-->
<xpath expr="//table[@class='table table-condensed']/tbody//td[last()]" position="after">
<td><span t-esc="o.ytd(line.code, allow_draft=True)" t-esc-options="{&quot;widget&quot;: &quot;monetary&quot;, &quot;display_currency&quot;: o.company_id.currency_id}"/></td>
<xpath expr="//table[2]/tbody//td[last()]" position="after">
<td><span t-esc="o.ytd(line.code, allow_draft=True)" t-options="{&quot;widget&quot;: &quot;monetary&quot;, &quot;display_currency&quot;: o.company_id.currency_id}"/></td>
</xpath>
</template>
</odoo>