[IMP] timesheet: Improve timesheet report
Some small improvements in timesheet report view. In measures of graph, take string attribute into account. closes odoo/odoo#41348 Taskid: 2149371 Related: odoo/enterprise#7041 Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
This commit is contained in:
committed by
Yannick Tivisse
parent
b4f1c8fe95
commit
ffe324877d
@@ -50,7 +50,10 @@
|
||||
<field name="name">Timesheets By Project</field>
|
||||
<field name="res_model">account.analytic.line</field>
|
||||
<field name="domain">[('project_id', '!=', False)]</field>
|
||||
<field name="context">{'search_default_groupby_project':1,}</field>
|
||||
<field name="context">{
|
||||
'search_default_groupby_project': 1,
|
||||
'search_default_groupby_employee': 1,
|
||||
}</field>
|
||||
<field name="search_view_id" ref="hr_timesheet_line_search"/>
|
||||
<field name="help" type="html">
|
||||
<p class="o_view_nocontent_smiling_face">
|
||||
|
||||
@@ -57,6 +57,7 @@
|
||||
<field name="employee_id" type="row"/>
|
||||
<field name="date" interval="month" type="col"/>
|
||||
<field name="unit_amount" type="measure" widget="timesheet_uom"/>
|
||||
<field name="amount" string="Timesheet Costs"/>
|
||||
</pivot>
|
||||
</field>
|
||||
</record>
|
||||
@@ -69,6 +70,7 @@
|
||||
<field name="task_id" type="row"/>
|
||||
<field name="project_id" type="row"/>
|
||||
<field name="unit_amount" type="measure" widget="timesheet_uom"/>
|
||||
<field name="amount" string="Timesheet Costs"/>
|
||||
</graph>
|
||||
</field>
|
||||
</record>
|
||||
@@ -122,6 +124,7 @@
|
||||
<search string="Timesheet">
|
||||
<field name="date"/>
|
||||
<field name="employee_id"/>
|
||||
<field name="department_id"/>
|
||||
<field name="project_id"/>
|
||||
<field name="task_id"/>
|
||||
<field name="name"/>
|
||||
@@ -129,10 +132,11 @@
|
||||
<separator/>
|
||||
<filter name="month" string="Date" date="date"/>
|
||||
<group expand="0" string="Group By">
|
||||
<filter string="Employee" name="groupby_employee" domain="[]" context="{'group_by': 'employee_id'}"/>
|
||||
<filter string="Project" name="groupby_project" domain="[]" context="{'group_by': 'project_id'}"/>
|
||||
<filter string="Task" name="groupby_task" domain="[]" context="{'group_by': 'task_id'}"/>
|
||||
<filter string="Date" name="groupby_date" domain="[]" context="{'group_by': 'date'}" help="Timesheet by Date"/>
|
||||
<filter string="Department" name="groupby_department" domain="[]" context="{'group_by': 'department_id'}"/>
|
||||
<filter string="Employee" name="groupby_employee" domain="[]" context="{'group_by': 'employee_id'}"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
|
||||
@@ -16,8 +16,7 @@
|
||||
<field name="model">hr.timesheet.attendance.report</field>
|
||||
<field name="arch" type="xml">
|
||||
<pivot string="timesheet attendance" disable_linking="True">
|
||||
<field name="user_id" type="row"/>
|
||||
<field name="date" interval="day" type="col"/>
|
||||
<field name="date" interval="month" type="row"/>
|
||||
<field name="total_difference" type="measure" widget="float_time"/>
|
||||
<field name="total_timesheet" type="measure" widget="float_time"/>
|
||||
<field name="total_attendance" type="measure" widget="float_time"/>
|
||||
@@ -29,6 +28,7 @@
|
||||
<field name="name">HR Timesheet/Attendance Report</field>
|
||||
<field name="res_model">hr.timesheet.attendance.report</field>
|
||||
<field name="view_mode">pivot</field>
|
||||
<field name="view_id" ref="view_hr_timesheet_attendance_report_pivot"/>
|
||||
<field name="context">{'search_default_week': True}</field>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -6,12 +6,18 @@
|
||||
<field name="model">account.analytic.line</field>
|
||||
<field name="inherit_id" ref="hr_timesheet.hr_timesheet_line_search"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='department_id']" position="after">
|
||||
<field name="timesheet_invoice_type"/>
|
||||
</xpath>
|
||||
<xpath expr="//filter[@name='month']" position="before">
|
||||
<filter name="billable_time" string="Billed on Timesheets" domain="[('timesheet_invoice_type', '=', 'billable_time')]"/>
|
||||
<filter name="billable_fixed" string="Billed at a Fixed Price" domain="[('timesheet_invoice_type', '=', 'billable_fixed')]"/>
|
||||
<filter name="non_billable" string="Non Billable Tasks" domain="[('timesheet_invoice_type', '=', 'non_billable')]"/>
|
||||
<separator/>
|
||||
</xpath>
|
||||
<xpath expr="//filter[@name='groupby_department']" position="before">
|
||||
<filter string="Billable Type" name="groupby_timesheet_invoice_type" domain="[]" context="{'group_by': 'timesheet_invoice_type'}"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -55,32 +61,46 @@
|
||||
Reporting
|
||||
-->
|
||||
<record id="timesheet_action_billing_report" model="ir.actions.act_window">
|
||||
<field name="name">Timesheets By Billing Rate</field>
|
||||
<field name="name">Timesheets By Billing Type</field>
|
||||
<field name="res_model">account.analytic.line</field>
|
||||
<field name="view_mode">pivot,graph</field>
|
||||
<field name="domain">[('project_id', '!=', False)]</field>
|
||||
<field name="context">{"search_default_week":1}</field>
|
||||
<field name="context">{
|
||||
'search_default_groupby_date': 1,
|
||||
}</field>
|
||||
<field name="search_view_id" ref="hr_timesheet.hr_timesheet_line_search"/>
|
||||
</record>
|
||||
|
||||
<record id="timesheet_filter_billing" model="ir.filters">
|
||||
<field name="name">Billing Rate</field>
|
||||
<field name="model_id">account.analytic.line</field>
|
||||
<field name="user_id" eval="False"/>
|
||||
<field name="domain">[('project_id', '!=', False)]</field>
|
||||
<field name="is_default" eval="True"/>
|
||||
<field name="context">{
|
||||
'col_group_by': ['date:month', 'timesheet_invoice_type'],
|
||||
'group_by': ['project_id', 'employee_id'],
|
||||
'measures': ['amount_currency', 'unit_amount', '__count']
|
||||
}</field>
|
||||
<field name="action_id" ref="timesheet_action_billing_report"/>
|
||||
<record id="view_hr_timesheet_line_pivot_billing_rate" model="ir.ui.view">
|
||||
<field name="name">account.analytic.line.pivot.billing.rate</field>
|
||||
<field name="model">account.analytic.line</field>
|
||||
<field name="arch" type="xml">
|
||||
<pivot string="Timesheet">
|
||||
<field name="timesheet_invoice_type" type="col"/>
|
||||
<field name="unit_amount" type="measure" widget="timesheet_uom"/>
|
||||
<field name="amount" string="Timesheet Costs"/>
|
||||
</pivot>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="timesheet_action_view_report_by_billing_rate_pivot" model="ir.actions.act_window.view">
|
||||
<field name="sequence" eval="5"/>
|
||||
<field name="view_mode">pivot</field>
|
||||
<field name="view_id" ref="view_hr_timesheet_line_pivot_billing_rate"/>
|
||||
<field name="act_window_id" ref="timesheet_action_billing_report"/>
|
||||
</record>
|
||||
|
||||
<record id="timesheet_action_view_report_by_billing_rate_graph" model="ir.actions.act_window.view">
|
||||
<field name="sequence" eval="6"/>
|
||||
<field name="view_mode">graph</field>
|
||||
<field name="view_id" ref="hr_timesheet.view_hr_timesheet_line_graph"/>
|
||||
<field name="act_window_id" ref="timesheet_action_billing_report"/>
|
||||
</record>
|
||||
|
||||
<menuitem id="menu_timesheet_billing_analysis"
|
||||
parent="hr_timesheet.menu_timesheets_reports_timesheet"
|
||||
action="timesheet_action_billing_report"
|
||||
name="By Billing Rate"
|
||||
name="By Billing Type"
|
||||
sequence="40"/>
|
||||
|
||||
<!--
|
||||
|
||||
@@ -46,6 +46,8 @@ var GraphView = AbstractView.extend({
|
||||
var groupableFields = {};
|
||||
this.fields.__count__ = {string: _t("Count"), type: "integer"};
|
||||
|
||||
var measureString = {};
|
||||
|
||||
this.arch.children.forEach(function (field) {
|
||||
var fieldName = field.attrs.name;
|
||||
if (fieldName === "id") {
|
||||
@@ -61,6 +63,9 @@ var GraphView = AbstractView.extend({
|
||||
} else {
|
||||
groupBys.push(fieldName);
|
||||
}
|
||||
if (field.attrs.string) {
|
||||
measureString[fieldName] = field.attrs.string;
|
||||
}
|
||||
});
|
||||
|
||||
_.each(this.fields, function (field, name) {
|
||||
@@ -75,6 +80,12 @@ var GraphView = AbstractView.extend({
|
||||
}
|
||||
});
|
||||
|
||||
_.each(measureString, function (string, name) {
|
||||
if (measures[name]) {
|
||||
measures[name].string = string;
|
||||
}
|
||||
});
|
||||
|
||||
this.controllerParams.measures = measures;
|
||||
this.controllerParams.groupableFields = groupableFields;
|
||||
this.rendererParams.fields = this.fields;
|
||||
|
||||
Reference in New Issue
Block a user