Skip to content
Snippets Groups Projects
hr_timesheet_templates.xml 15.87 KiB
<?xml version="1.0" encoding="utf-8"?>
<odoo>

    <template id="assets_backend" name="sale timesheet assets" inherit_id="web.assets_backend">
        <xpath expr="." position="inside">
            <script type="text/javascript" src="/sale_timesheet/static/src/js/timesheet_plan.js"></script>
            <link rel="stylesheet" href="/sale_timesheet/static/src/less/sale_timesheet.less"/>
        </xpath>
    </template>

    <template id="timesheet_plan" name="Timesheet Plan">
        <div class="o_form_view o_form_readonly o_project_plan">
            <div class="o_form_sheet_bg">
                <div class="o_form_sheet o_timesheet_plan_content">
                    <div class="o_timesheet_plan_sale_timesheet">
                        <div class="o_timesheet_plan_sale_timesheet_dashboard">

                            <div class="o_timesheet_plan_stat_buttons oe_button_box">
                                <t t-foreach="stat_buttons" t-as="stat_button">
                                    <button class="btn btn-sm oe_stat_button" t-att-data-domain="stat_button['domain']" t-att-data-res-model="stat_button['res_model']">
                                        <div t-attf-class="fa fa-fw o_button_icon #{stat_button['icon']}"></div>
                                        <div name="task_count" class="o_field_widget o_stat_info o_readonly_modifier" t-att-title="stat_button['name']">
                                            <span class="o_stat_value" t-if="stat_button.get('count')">
                                                <t t-esc="stat_button['count']"/>
                                            </span>
                                            <span class="o_stat_text">
                                                <t t-esc="stat_button['name']"/>
                                            </span>
                                        </div>
                                    </button>
                                </t>
                            </div>

                            <table class="table">
                                <tbody>
                                    <tr>
                                        <th rowspan="5">
                                            <a type="action" t-att-domain="json.dumps(domain)" context="{'pivot_row_groupby': ['date:month'],'pivot_column_groupby': ['timesheet_invoice_type'], 'pivot_measures': ['unit_amount']}">Hours</a>
                                        </th>
                                        <td class="o_timesheet_plan_dashboard_cell">
                                            <t t-esc="dashboard['hours']['billable_time']" t-options="{'widget': 'float_time'}"/>
                                        </td>
                                        <td>Timesheets</td>
                                        <th rowspan="5">
                                            <a type="action" t-att-domain="json.dumps(domain)" context="{'pivot_row_groupby': ['date:month', 'employee_id'], 'pivot_column_groupby': ['timesheet_invoice_type'],'pivot_measures': ['unit_amount']}">Rates</a>
                                        </th>
                                        <td class="o_timesheet_plan_dashboard_cell">
                                            <t t-esc="dashboard['rates']['billable_time']"/> %
                                        </td>
                                        <td>Timesheets</td>
                                        <th rowspan="5">
                                            <a type="action" t-att-domain="json.dumps(domain)" context="{'pivot_row_groupby': ['timesheet_invoice_id'], 'pivot_column_groupby': ['date:month'],'pivot_measures': ['amount', 'timesheet_revenue']}">Profitability</a>
                                        </th>
                                        <td class="o_timesheet_plan_dashboard_cell">
                                            <t t-if="currency.position == 'before'" t-esc="currency.symbol"/>
                                            <t t-esc="dashboard['money_amount']['invoiced']"/>
                                            <t t-if="currency.position == 'after'" t-esc="currency.symbol"/>
                                        </td>
                                        <td>Invoiced</td>
                                    </tr>
                                    <tr>
                                        <td class="o_timesheet_plan_dashboard_cell">
                                            <t t-esc="dashboard['hours']['billable_fixed']" t-options="{'widget': 'float_time'}"/>
                                        </td>
                                        <td>Fixed</td>
                                        <td class="o_timesheet_plan_dashboard_cell">
                                            <t t-esc="dashboard['rates']['billable_fixed']"/> %
                                        </td>
                                        <td>Fixed</td>
                                        <td class="o_timesheet_plan_dashboard_cell">
                                            <t t-if="currency.position == 'before'" t-esc="currency.symbol"/>
                                            <t t-esc="dashboard['money_amount']['to_invoice']"/>
                                            <t t-if="currency.position == 'after'" t-esc="currency.symbol"/>
                                        </td>
                                        <td>To invoice</td>
                                    </tr>
                                    <tr>
                                        <td class="o_timesheet_plan_dashboard_cell">
                                            <t t-esc="dashboard['hours']['non_billable_project']" t-options="{'widget': 'float_time'}"/>
                                        </td>
                                        <td>No task found</td>
                                        <td class="o_timesheet_plan_dashboard_cell">
                                            <t t-esc="dashboard['rates']['non_billable_project']"/> %
                                        </td>
                                        <td>No task found</td>
                                        <td class="o_timesheet_plan_dashboard_cell">
                                            <t t-if="currency.position == 'before'" t-esc="currency.symbol"/>
                                            <t t-esc="dashboard['money_amount']['cost']"/>
                                            <t t-if="currency.position == 'after'" t-esc="currency.symbol"/>
                                        </td>
                                        <td>Cost</td>
                                    </tr>
                                    <tr>
                                        <td class="o_timesheet_plan_dashboard_cell">
                                            <t t-esc="dashboard['hours']['non_billable']" t-options="{'widget': 'float_time'}"/>
                                        </td>
                                        <td>Non Billable</td>
                                        <td class="o_timesheet_plan_dashboard_cell">
                                            <t t-esc="dashboard['rates']['non_billable']"/> %
                                        </td>
                                        <td>Non Billable</td>
                                        <td class="o_timesheet_plan_dashboard_cell"></td>
                                        <td></td>
                                    </tr>
                                    <tr>
                                        <td class="o_timesheet_plan_dashboard_total">
                                            <t t-esc="dashboard['hours']['total']" t-options="{'widget': 'float_time'}"/>
                                        </td>
                                        <td><b>Total</b></td>
                                        <td></td>
                                        <td></td>
                                        <td class="o_timesheet_plan_dashboard_total">
                                            <t t-if="currency.position == 'before'" t-esc="currency.symbol"/>
                                            <t t-esc="dashboard['money_amount']['total']"/>
                                            <t t-if="currency.position == 'after'" t-esc="currency.symbol"/>
                                        </td>
                                        <td><b>Total</b></td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>

                        <div class="o_timesheet_plan_sale_timesheet_people_time">
                            <h3>Time by people</h3>
                            <t t-if="not repartition_employee">
                                <p>There is no timesheet for now.</p>
                            </t>
                            <t t-if="repartition_employee">
                                <div class="pull-right o_timesheet_plan_badge">
                                    <span class="badge o_progress_billable_fixed">
                                        <a type="action" t-att-domain="json.dumps(domain + [('timesheet_invoice_type','=','billable_fixed')])">Billable fixed</a>
                                    </span>
                                    <span class="badge o_progress_billable_time">
                                        <a type="action" t-att-domain="json.dumps(domain + [('timesheet_invoice_type','=','billable_time')])">Billable time</a>
                                    </span>
                                    <span class="badge o_progress_non_billable_project">
                                        <a type="action" t-att-domain="json.dumps(domain + [('timesheet_invoice_type','=','non_billable_project')])">No task found</a>
                                    </span>
                                    <span class="badge o_progress_non_billable">
                                        <a type="action" t-att-domain="json.dumps(domain + [('timesheet_invoice_type','=','non_billable')])">Non billable</a>
                                    </span>
                                </div>
                                <table class="table">
                                    <tbody>
                                        <t t-foreach="repartition_employee" t-as="employee_id">
                                            <tr>
                                                <td style="width: 15%">
                                                    <a type="action" t-att-domain="json.dumps(domain)" t-att-context="{'search_default_employee_id': employee_id}" views="[[0, 'list']]">
                                                        <t t-esc="repartition_employee[employee_id]['employee_name']"/>
                                                    </a>
                                                </td>
                                                <td style="width: 10%">
                                                    <t t-esc="repartition_employee[employee_id]['total']" t-options="{'widget': 'float_time'}"/>
                                                </td>
                                                <td>
                                                    <div class="progress" t-att-style="'width: ' + str(repartition_employee[employee_id]['total'] / repartition_employee_max * 100) +'%'">

                                                        <t t-set="total" t-value="repartition_employee[employee_id]['total']" />
                                                        <t t-set="billable_fixed" t-value="repartition_employee[employee_id]['billable_fixed']" />
                                                        <t t-set="billable_time" t-value="repartition_employee[employee_id]['billable_time']" />
                                                        <t t-set="non_billable" t-value="repartition_employee[employee_id]['non_billable']" />
                                                        <t t-set="non_billable_project" t-value="repartition_employee[employee_id]['non_billable_project']"/>

                                                        <t t-if="billable_fixed">
                                                            <t t-set="billable_fixed_title"><t t-esc="billable_fixed" t-options="{'widget': 'float_time'}" /></t>
                                                            <div class="progress-bar o_progress_billable_fixed"
                                                                 t-att-style="'width: ' + str(billable_fixed / total * 100) + '%'"
                                                                 t-att-title="billable_fixed_title"
                                                                 t-att-data-domain="repartition_employee[employee_id]['__domain_billable_fixed']">
                                                            </div>
                                                        </t>
                                                        <t t-if="billable_time">
                                                            <t t-set="billable_time_title"><t t-esc="billable_time" t-options="{'widget': 'float_time'}" /></t>
                                                            <div class="progress-bar o_progress_billable_time"
                                                                 t-att-style="'width: ' + str(billable_time / total * 100) + '%'"
                                                                 t-att-title="billable_time_title"
                                                                 t-att-data-domain="repartition_employee[employee_id]['__domain_billable_time']">
                                                            </div>
                                                        </t>
                                                        <t t-if="non_billable_project">
                                                            <t t-set="non_billable_project_title"><t t-esc="non_billable_project" t-options="{'widget': 'float_time'}" /></t>
                                                            <div class="progress-bar o_progress_non_billable_project"
                                                                 t-att-style="'width: ' + str(non_billable_project / total * 100) + '%'"
                                                                 t-att-title="non_billable_project_title"
                                                                 t-att-data-domain="repartition_employee[employee_id]['__domain_non_billable_project']">
                                                            </div>
                                                        </t>
                                                        <t t-if="non_billable">
                                                            <t t-set="non_billable_title"><t t-esc="non_billable" t-options="{'widget': 'float_time'}" /></t>
                                                            <div class="progress-bar o_progress_non_billable"
                                                                 t-att-style="'width: ' + str(non_billable / total * 100) + '%'"
                                                                 t-att-title="non_billable_title"
                                                                 t-att-data-domain="json.dumps(repartition_employee[employee_id]['__domain_non_billable'])">
                                                            </div>
                                                        </t>
                                                    </div>
                                                </td>
                                            </tr>
                                        </t>
                                    </tbody>
                                </table>
                            </t>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </template>

</odoo>