Initial commit of timesheet_invoice for 11.0 -- Include detailed timesheet entries on invoice PDF.

This commit is contained in:
Jared Kipe
2018-05-23 11:49:49 -07:00
parent 0a21d042d1
commit a5ff0328d7
3 changed files with 53 additions and 0 deletions

View File

View File

@@ -0,0 +1,20 @@
{
'name': 'Timesheet Invoice',
'version': '11.0.1.0.0',
'author': 'Hibou Corp. <hello@hibou.io>',
'website': 'https://hibou.io/',
'license': 'AGPL-3',
'category': 'Tools',
'complexity': 'easy',
'description': """
Adds timesheet descriptions onto the invoice report/PDF.
""",
'depends': [
'sale_timesheet',
],
'data': [
'invoice_views.xml',
],
'installable': True,
'auto_install': False,
}

View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<template id="report_invoice_document_inherit" inherit_id="account.report_invoice_document">
<xpath expr="//div[@class='page']" position="inside">
<div class="container" t-if="o.timesheet_ids">
<hr/>
<h3>Timesheets</h3>
<table class="table table-sm">
<thead>
<tr class="active">
<th>Date</th>
<th class="col-md-6">Description</th>
<th>Responsible</th>
<th>Duration</th>
</tr>
</thead>
<t t-foreach="o.timesheet_ids.mapped('project_id')" t-as="project">
<tr class="bg-primary"><td><h4>Project</h4></td><td colspan="3"><h4 t-esc="project.name"/></td></tr>
<t t-foreach="o.timesheet_ids.filtered(lambda l: l.project_id == project).mapped('task_id')" t-as="task">
<tr class="bg-info"><td><h5>Task</h5></td><td colspan="3"><h5 t-esc="task.name"/></td></tr>
<tr t-foreach="o.timesheet_ids.filtered(lambda l: l.project_id == project and l.task_id == task)" t-as="timesheet">
<td><t t-esc="timesheet.date"/></td>
<td><t t-esc="timesheet.name"/></td>
<td><t t-esc="timesheet.sudo().user_id.name"/></td>
<td><span t-field="timesheet.unit_amount" t-field-options="{&quot;widget&quot;: &quot;duration&quot;, &quot;unit&quot;: &quot;hour&quot;, &quot;round&quot;: &quot;minute&quot;}"/></td>
</tr>
</t>
</t>
</table>
</div>
</xpath>
</template>
</odoo>