summaryrefslogtreecommitdiff
path: root/addons/hr_timesheet/report/report_timesheet_templates.xml
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
committerstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
commit3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch)
treea44932296ef4a9b71d5f010906253d8c53727726 /addons/hr_timesheet/report/report_timesheet_templates.xml
parent0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff)
initial commit 2
Diffstat (limited to 'addons/hr_timesheet/report/report_timesheet_templates.xml')
-rw-r--r--addons/hr_timesheet/report/report_timesheet_templates.xml96
1 files changed, 96 insertions, 0 deletions
diff --git a/addons/hr_timesheet/report/report_timesheet_templates.xml b/addons/hr_timesheet/report/report_timesheet_templates.xml
new file mode 100644
index 00000000..1e74abae
--- /dev/null
+++ b/addons/hr_timesheet/report/report_timesheet_templates.xml
@@ -0,0 +1,96 @@
+<odoo>
+ <template id="report_timesheet">
+ <t t-call="web.html_container">
+ <t t-call="web.external_layout">
+ <t t-set="company" t-value="docs.mapped('project_id')[0].company_id if len(docs.mapped('project_id')) == 1 else docs.env.company"/>
+ <t t-set="show_task" t-value="bool(docs.mapped('task_id'))"/>
+ <t t-set="show_project" t-value="len(docs.mapped('project_id')) > 1"/>
+ <div class="page">
+ <div class="oe_structure"/>
+ <div class="row" style="margin-top:10px;">
+ <div class="col-lg-12">
+ <h2>
+ <span>Timesheet Entries
+ <t t-if="len(docs.mapped('project_id')) == 1">
+ for the <t t-esc="docs.mapped('project_id')[0].name"/> Project
+ </t>
+ </span>
+ </h2>
+ </div>
+ </div>
+
+ <div class="row" style="margin-top:10px;">
+ <div class="col-lg-12">
+ <t t-set='is_uom_day' t-value='docs._is_timesheet_encode_uom_day()'/>
+ <table class="table table-sm">
+ <thead>
+ <tr>
+ <th class="align-middle"><span>Date</span></th>
+ <th class="align-middle"><span>Responsible</span></th>
+ <th class="align-middle"><span>Description</span></th>
+ <th class="align-middle" t-if="show_project"><span>Project</span></th>
+ <th class="align-middle" t-if="show_task"><span>Task</span></th>
+ <th class="text-right">
+ <span t-if="is_uom_day">Time Spent (Days)</span>
+ <span t-else="">Time Spent (Hours)</span>
+ </th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr t-foreach="docs" t-as="l">
+ <td>
+ <span t-field="l.date"/>
+ </td>
+ <td>
+ <span t-field="l.user_id.partner_id.name"/>
+ <span t-if="not l.user_id.partner_id.name" t-field="l.employee_id"/>
+ </td>
+ <td >
+ <span t-field="l.name" t-options="{'widget': 'text'}"/>
+ </td>
+ <td t-if="show_project">
+ <span t-field="l.project_id.sudo().name"/>
+ </td>
+ <td t-if="show_task">
+ <t t-if="l.task_id"><span t-field="l.task_id.sudo().name"/></t>
+ </td>
+ <td class="text-right">
+ <span t-if="is_uom_day" t-esc="l._get_timesheet_time_day()" t-options="{'widget': 'timesheet_uom'}"/>
+ <span t-else="" t-field="l.unit_amount" t-options="{'widget': 'duration', 'digital': True, 'unit': 'hour', 'round': 'minute'}"/>
+ </td>
+ </tr>
+ <tr>
+ <t t-set="nbCols" t-value="4"/>
+ <t t-if="show_project" t-set="nbCols" t-value="nbCols + 1"/>
+ <t t-if="show_task" t-set="nbCols" t-value="nbCols + 1"/>
+ <td class="text-right" t-attf-colspan="{{nbCols}}">
+ <strong t-if="is_uom_day">
+ <span style="margin-right: 15px;">Total (Days)</span>
+ <t t-esc="docs._convert_hours_to_days(sum(docs.mapped('unit_amount')))" t-options="{'widget': 'timesheet_uom'}"/>
+ </strong>
+ <strong t-else="">
+ <span style="margin-right: 15px;">Total (Hours)</span>
+ <t t-esc="sum(docs.mapped('unit_amount'))" t-options="{'widget': 'duration', 'digital': True, 'unit': 'hour', 'round': 'minute'}"/>
+ </strong>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </div>
+ <div class="oe_structure"/>
+ </div>
+ </t>
+ </t>
+ </template>
+
+ <record id="timesheet_report" model="ir.actions.report">
+ <field name="name">Timesheet Entries</field>
+ <field name="model">account.analytic.line</field>
+ <field name="report_type">qweb-pdf</field>
+ <field name="report_name">hr_timesheet.report_timesheet</field>
+ <field name="report_file">report_timesheet</field>
+ <field name="binding_model_id" ref="model_account_analytic_line"/>
+ <field name="binding_type">report</field>
+ </record>
+</odoo>