Merge branch 'development' of http://103.74.223.20:8085/prakash.jain/cor-odoo into pawan_branch

This commit is contained in:
Pawan Kumar 2021-02-23 09:41:21 +05:30
commit da5c504f77
3 changed files with 55 additions and 24 deletions

View File

@ -30,7 +30,7 @@ class BudgetHrsAnalysis(models.Model):
('hours_in_consultant', 'Hours are budgeted according to a consultant'),
('hours_no_limit', 'Total hours are budgeted without division to consultant'),
], string="Project Type", readonly=True)
timesheet_date = fields.Date(string='Timesheet Date', readonly=True)
#timesheet_date = fields.Date(string='Timesheet Date', readonly=True)
#budgeted_hours = fields.Float("Budgeted Hours", digits=(16, 2), readonly=True, group_operator="sum")
#actual_hours = fields.Float("Actual Hours", digits=(16, 2), readonly=True, group_operator="sum")
@ -52,11 +52,6 @@ class BudgetHrsAnalysis(models.Model):
parent_project,
startdate as start_date,
enddate as end_date,
--is_sub_project,
--sub_project,
--date_start AS start_date,
--date AS end_date,
timesheet_date,
pricing_type as pricing_type,
project_type as project_type,
partner_id,
@ -70,7 +65,6 @@ class BudgetHrsAnalysis(models.Model):
date_start AS startdate,
date AS enddate,
'Budgeted Hours' as hours_type,
null::date AS timesheet_date,
pro_emp.budgeted_qty as hours,
pro.*
FROM
@ -87,7 +81,6 @@ class BudgetHrsAnalysis(models.Model):
date_start AS startdate,
date AS enddate,
'Budgeted Hours' as hours_type,
null::date AS timesheet_date,
pro.budgeted_hours2 as hours,
pro.*
FROM
@ -101,10 +94,9 @@ class BudgetHrsAnalysis(models.Model):
pro.id AS project_id,
(select project_id from project_subproject_rel as par where pro.id=par.id limit 1) as parent_project,
AAL.employee_id AS employee_id,
start_datetime AS startdate,
end_datetime AS enddate,
coalesce(pro.date_start, (select min(al.start_datetime::date) from account_analytic_line as al where pro.id=al.project_id)) AS startdate,
(select max(al.end_datetime::date) from account_analytic_line as al) as enddate,
'Actual Hours' as hours_type,
AAL.date AS timesheet_date,
unit_amount as hours,
pro.*
FROM project_project PRO
@ -112,28 +104,40 @@ class BudgetHrsAnalysis(models.Model):
LEFT JOIN account_analytic_account AA ON PRO.analytic_account_id = AA.id
LEFT JOIN account_analytic_line AAL ON AAL.account_id = AA.id and AAL.project_id = PRO.id and AAL.employee_id = pro_emp.employee_id
Where
PRO.active = 't' and PRO.pricing_type = 'employee_rate'
--and PRO.project_type = 'hours_in_consultant'
PRO.active = 't'
and PRO.pricing_type = 'employee_rate' and PRO.project_type = 'hours_in_consultant' and AAL.employee_id is not null
Union all
SELECT
pro.id AS project_id,
(select project_id from project_subproject_rel as par where pro.id=par.id limit 1) as parent_project,
AAL.employee_id AS employee_id,
start_datetime::DATE AS startdate,
end_datetime::DATE AS enddate,
coalesce(pro.date_start, (select min(al.start_datetime::date) from account_analytic_line as al where pro.id=al.project_id)) AS startdate,
(select max(al.end_datetime::date) from account_analytic_line as al) as enddate,
'Actual Hours' as hours_type,
unit_amount as hours,
pro.*
FROM project_project PRO
LEFT JOIN account_analytic_account AA ON PRO.analytic_account_id = AA.id
LEFT JOIN account_analytic_line AAL ON AAL.account_id = AA.id and AAL.project_id = PRO.id
Where
PRO.active = 't'
and PRO.pricing_type = 'employee_rate' and PRO.project_type = 'hours_no_limit' and AAL.employee_id is not null
Union all
SELECT
pro.id AS project_id,
(select project_id from project_subproject_rel as par where pro.id=par.id limit 1) as parent_project,
AAL.employee_id AS employee_id,
pro.date_start AS startdate,
(select max(al.end_datetime::date) from account_analytic_line as al) as enddate,
'Actual Hours' as hours_type,
AAL.date AS timesheet_date,
unit_amount as hours,
pro.*
FROM project_project PRO
--Left JOIN project_sale_line_employee_map pro_emp ON pro_emp.project_id = pro.id
LEFT JOIN account_analytic_account AA ON PRO.analytic_account_id = AA.id
LEFT JOIN account_analytic_line AAL ON AAL.account_id = AA.id and AAL.project_id = PRO.id
--and AAL.employee_id = pro_emp.employee_id
Where
PRO.active = 't'
and PRO.pricing_type = 'fixed_rate'
--and PRO.project_type = 'hours_in_consultant'
) as res
order by
project_id desc,

View File

@ -34,7 +34,7 @@
<field name="start_date"/>
<field name="end_date"/>
<field name="employee_id"/>
<field name="timesheet_date" optional="hide"/>
<!--<field name="timesheet_date" optional="hide"/>-->
<field name="hours_type"/>
<field name="hours"/>
<field name="parent_project" optional="hide"/>
@ -53,7 +53,7 @@
<field name="employee_id"/>
<field name="start_date"/>
<field name="end_date"/>
<field name="timesheet_date"/>
<!--<field name="timesheet_date"/>-->
<filter string="Fixed rate" name="fixed" domain="[('pricing_type','=','fixed_rate')]"/>
<filter string="Hours are budgeted according to a consultant" name="cons" domain="[('project_type','=','hours_in_consultant')]"/>
<filter string="Total hours are budgeted without division to consultant" name="limit" domain="[('project_type','=','hours_no_limit')]"/>
@ -64,7 +64,7 @@
<filter string="Consultant" name="group_by_employee_id" context="{'group_by':'employee_id'}"/>
<filter string="Start Date" name="sdate" domain="[]" context="{'group_by':'start_date:day'}"/>
<filter string="End Date" name="edate" domain="[]" context="{'group_by':'end_date:day'}"/>
<filter string="Timesheet Date" name="tdate" domain="[]" context="{'group_by':'timesheet_date:day'}"/>
<!--<filter string="Timesheet Date" name="tdate" domain="[]" context="{'group_by':'timesheet_date:day'}"/>-->
<filter string="Hours type" name="group_by_hours_type" context="{'group_by':'hours_type'}"/>
</group>
</search>

View File

@ -324,6 +324,32 @@ var MAX_LEGEND_LENGTH = 25 * (1 + config.device.size_class);
boxColor: boxColor,
};
},
/**
* This function extracts the information from the data points in tooltipModel.dataPoints
* (corresponding to datapoints over a given label determined by the mouse position)
* that will be displayed in a custom tooltip.
*
* @private
* @param {Object} tooltipModel see chartjs documentation
* @return {Object[]}
*/
_getTooltipItems: function (tooltipModel) {
var self = this;
var data = this.chart.config.data;
var orderedItems = tooltipModel.dataPoints.sort(function (dPt1, dPt2) {
return dPt2.yLabel - dPt1.yLabel;
});
return orderedItems.reduce(
function (acc, item) {
if (item.value > 0) {
acc.push(self._getTooltipItemContent(item, data));
}
return acc;
},
[]
);
},
_isRedirectionEnabled: function () {
return !this.disableLinking &&
@ -545,7 +571,8 @@ var MAX_LEGEND_LENGTH = 25 * (1 + config.device.size_class);
// this.title = 'Time Line';
if (self.resModel == 'project.budget.hrs.report') {
var groupedData = _.groupBy(data.datasets, x => x.label.replace('Actual Hours', '').replace('Budgeted Hours', ''));
var groupedData = _.groupBy(data.datasets, x => x.label.replace('Actual Hours', '').replace('Budgeted Hours', '').split("/")[0]);
//var groupedData = _.groupBy(data.datasets, x => x.label.replace('Actual Hours', '').replace('Budgeted Hours', ''));
_.map(groupedData, (y) => {
if (y.length > 1) {
var zipped_1 = _.zip.apply(null, [y[0].data, y[1].data]);
@ -678,7 +705,7 @@ var MAX_LEGEND_LENGTH = 25 * (1 + config.device.size_class);
var data = this._prepareData(dataPoints);
if (self.resModel == 'project.budget.hrs.report') {
var groupedData = _.groupBy(data.datasets, x => x.label.replace('Actual Hours', '').replace('Budgeted Hours', ''));
var groupedData = _.groupBy(data.datasets, x => x.label.replace('Actual Hours', '').replace('Budgeted Hours', '').split("/")[0]);
_.map(groupedData, (y) => {
if (y.length > 1) {
var zipped_1 = _.zip.apply(null, [y[0].data, y[1].data]);