Merge branch 'development' into 'master'
Development See merge request prakash.jain/cor-odoo!139
This commit is contained in:
commit
fe08ace94f
|
@ -133,38 +133,46 @@ class AccountAnalyticLine(models.Model):
|
|||
res = super(AccountAnalyticLine, self).export_data(fields)
|
||||
for index, val in enumerate(res['datas']):
|
||||
#print("task_id", fields_name)
|
||||
if fields_name.get('date') and fields_name.get('date') >= 0:
|
||||
#if fields_name.get('date') and fields_name.get('date') >= 0:
|
||||
if fields_name.get('date') is not None:
|
||||
tdateindex = fields_name.get('date')
|
||||
tdate = res['datas'][index][tdateindex]
|
||||
if tdate:
|
||||
res['datas'][index][tdateindex] = datetime.strftime(tdate, "%d/%m/%Y")
|
||||
if fields_name.get('start_datetime') and fields_name.get('start_datetime') >= 0:
|
||||
#if fields_name.get('start_datetime') and fields_name.get('start_datetime') >= 0:
|
||||
if fields_name.get('start_datetime') is not None:
|
||||
start_datetime_index = fields_name.get('start_datetime')
|
||||
start_datetime = res['datas'][index][start_datetime_index]
|
||||
if start_datetime:
|
||||
res['datas'][index][start_datetime_index] = datetime.strftime(start_datetime, "%d/%m/%Y %H:%M")
|
||||
if fields_name.get('end_datetime') and fields_name.get('end_datetime') >= 0:
|
||||
if fields_name.get('end_datetime') is not None:
|
||||
end_datetime_index = fields_name.get('end_datetime')
|
||||
end_datetime= res['datas'][index][end_datetime_index]
|
||||
if end_datetime:
|
||||
res['datas'][index][end_datetime_index] = datetime.strftime(end_datetime, "%d/%m/%Y %H:%M")
|
||||
if fields_name.get('task_id') and fields_name.get('task_id') >= 0:
|
||||
if fields_name.get('task_id') is not None:
|
||||
taskindex = fields_name.get('task_id')
|
||||
ttask = res['datas'][index][taskindex]
|
||||
if type(ttask) == bool:
|
||||
res['datas'][index][taskindex] = ''
|
||||
if fields_name.get('start_time') and fields_name.get('start_time') >= 0:
|
||||
if fields_name.get('start_time') is not None:
|
||||
starttimeindex = fields_name.get('start_time')
|
||||
starttime = float(res['datas'][index][starttimeindex])
|
||||
if starttime:
|
||||
start_time = tools.format_duration(starttime)
|
||||
res['datas'][index][starttimeindex] = start_time
|
||||
if fields_name.get('end_time') and fields_name.get('end_time') >= 0:
|
||||
if fields_name.get('end_time') is not None:
|
||||
endtimeindex = fields_name.get('end_time')
|
||||
endtime = float(res['datas'][index][endtimeindex])
|
||||
if endtime:
|
||||
end_time = tools.format_duration(endtime)
|
||||
res['datas'][index][endtimeindex] = end_time
|
||||
if fields_name.get('unit_amount') is not None:
|
||||
durationindex = fields_name.get('unit_amount')
|
||||
duration = res['datas'][index][durationindex] and float(res['datas'][index][durationindex])
|
||||
if duration:
|
||||
duration_time = tools.format_duration(duration)
|
||||
res['datas'][index][durationindex] = duration_time
|
||||
return res
|
||||
|
||||
@api.model
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
'report/project_budget_hrs_analysis_views.xml',
|
||||
'report/project_budget_amt_analysis_views.xml',
|
||||
'report/project_timeline_report_views.xml',
|
||||
'report/project_timesheet_report_views.xml',
|
||||
],
|
||||
'qweb': [
|
||||
"static/src/xml/base.xml",
|
||||
|
|
|
@ -4,3 +4,4 @@
|
|||
from . import project_budget_hrs_analysis
|
||||
from . import project_budget_amt_analysis
|
||||
from . import project_timeline_report
|
||||
from . import project_timesheet_report
|
||||
|
|
|
@ -59,6 +59,7 @@
|
|||
<filter string="Fixed rate" name="fixed" domain="[('pricing_type','=','fixed_rate')]"/>
|
||||
<filter string="Hours are budgeted according to a consultant" name="fixed" domain="[('project_type','=','hours_in_consultant')]"/>
|
||||
<filter string="Total hours are budgeted without division to consultant" name="limit" domain="[('project_type','=','hours_no_limit')]"/>
|
||||
<filter string="Not Fixed rate" name="notfixed" domain="[('pricing_type','!=','fixed_rate')]"/>
|
||||
<!--<filter string="Sub Project" name="subproject" domain="[('is_sub_project','=',True)]"/>-->
|
||||
<group expand="1" string="Group By">
|
||||
<filter string="Project" name="group_by_project" context="{'group_by':'project_id'}"/>
|
||||
|
@ -78,7 +79,7 @@
|
|||
<field name="res_model">project.budget.amt.report</field>
|
||||
<field name="view_mode">graph,tree,pivot</field>
|
||||
<field name="search_view_id" ref="project_budget_amt_report_view_search"/>
|
||||
<field name="context">{'search_default_group_by_project': 1,'search_default_group_by_amount_type': 1, 'default_res_model': 'project.budget.amt.report'}</field>
|
||||
<field name="context">{'search_default_group_by_project': 1,'search_default_group_by_amount_type': 1, 'default_res_model': 'project.budget.amt.report', 'search_default_notfixed':1}</field>
|
||||
</record>
|
||||
|
||||
<menuitem id="menu_project_budget_report_amt_analysis"
|
||||
|
|
|
@ -22,7 +22,7 @@ class BudgetHrsAnalysis(models.Model):
|
|||
employee_id = fields.Many2one('hr.employee', string='Consultant', readonly=True)
|
||||
hours_type = fields.Char(string="Hours Type", readonly=True)
|
||||
hours = fields.Float("Number of Hours", digits=(16, 2), readonly=True, group_operator="sum")
|
||||
timeline = fields.Float("Timeline", digits=(16, 2), readonly=True, group_operator="sum")
|
||||
#timeline = fields.Float("Timeline", digits=(16, 2), readonly=True, group_operator="sum")
|
||||
pricing_type = fields.Selection([
|
||||
('fixed_rate', 'Fixed rate'),
|
||||
('employee_rate', 'Consultant rate')
|
||||
|
@ -58,8 +58,8 @@ class BudgetHrsAnalysis(models.Model):
|
|||
partner_id,
|
||||
employee_id,
|
||||
hours_type,
|
||||
hours,
|
||||
timeline
|
||||
hours
|
||||
--timeline
|
||||
from (
|
||||
SELECT
|
||||
pro.id AS project_id,
|
||||
|
@ -67,9 +67,9 @@ class BudgetHrsAnalysis(models.Model):
|
|||
pro_emp.employee_id AS employee_id,
|
||||
date_start AS startdate,
|
||||
date AS enddate,
|
||||
'Budgeted' as hours_type,
|
||||
'Budgeted Hours' as hours_type,
|
||||
pro_emp.budgeted_qty as hours,
|
||||
pro_emp.budgeted_qty/8 as timeline,
|
||||
--pro_emp.budgeted_qty/8 as timeline,
|
||||
--(date - date_start) as timeline,
|
||||
pro.*
|
||||
FROM
|
||||
|
@ -85,10 +85,10 @@ class BudgetHrsAnalysis(models.Model):
|
|||
null::int AS employee_id,
|
||||
date_start AS startdate,
|
||||
date AS enddate,
|
||||
'Budgeted' as hours_type,
|
||||
'Budgeted Hours' as hours_type,
|
||||
pro.budgeted_hours2 as hours,
|
||||
--(date - date_start) as timeline,
|
||||
pro.budgeted_hours2/8 as timeline,
|
||||
--pro.budgeted_hours2/8 as timeline,
|
||||
pro.*
|
||||
FROM
|
||||
project_project PRO
|
||||
|
@ -103,9 +103,9 @@ class BudgetHrsAnalysis(models.Model):
|
|||
AAL.employee_id AS employee_id,
|
||||
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' as hours_type,
|
||||
'Actual Hours' as hours_type,
|
||||
unit_amount as hours,
|
||||
unit_amount/8 as timeline,
|
||||
--unit_amount/8 as timeline,
|
||||
--(select max(al.end_datetime::date) from account_analytic_line as al) -
|
||||
--coalesce(pro.date_start, (select min(al.start_datetime::date) from account_analytic_line as al where pro.id=al.project_id)) AS timeline,
|
||||
pro.*
|
||||
|
@ -123,9 +123,9 @@ class BudgetHrsAnalysis(models.Model):
|
|||
AAL.employee_id AS employee_id,
|
||||
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' as hours_type,
|
||||
'Actual Hours' as hours_type,
|
||||
unit_amount as hours,
|
||||
unit_amount/8 as timeline,
|
||||
--unit_amount/8 as timeline,
|
||||
--(select max(al.end_datetime::date) from account_analytic_line as al) -
|
||||
--(select min(al.start_datetime::date) from account_analytic_line as al where pro.id=al.project_id) AS timeline,
|
||||
pro.*
|
||||
|
@ -142,9 +142,9 @@ class BudgetHrsAnalysis(models.Model):
|
|||
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' as hours_type,
|
||||
'Actual Hours' as hours_type,
|
||||
unit_amount as hours,
|
||||
unit_amount/8 as timeline,
|
||||
--unit_amount/8 as timeline,
|
||||
--(select max(al.end_datetime::date) from account_analytic_line as al) - pro.date_start AS timeline,
|
||||
--DATE_PART('day', AGE(select max(al.end_datetime::date) from account_analytic_line, pro.date_start)) AS timeline,
|
||||
pro.*
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
<!--<field name="timesheet_date" optional="hide"/>-->
|
||||
<field name="hours_type"/>
|
||||
<field name="hours"/>
|
||||
<field name="timeline"/>
|
||||
<!--<field name="timeline"/>-->
|
||||
<field name="parent_project" optional="hide"/>
|
||||
</tree>
|
||||
</field>
|
||||
|
@ -58,6 +58,7 @@
|
|||
<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')]"/>
|
||||
<filter string="Not Fixed rate" name="notfixed" domain="[('pricing_type','!=','fixed_rate')]"/>
|
||||
<!--<filter string="Sub Project" name="subproject" domain="[('is_sub_project','=',True)]"/>-->
|
||||
<group expand="1" string="Group By">
|
||||
<filter string="Project" name="group_by_project" context="{'group_by':'project_id'}"/>
|
||||
|
@ -78,7 +79,7 @@
|
|||
<field name="res_model">project.budget.hrs.report</field>
|
||||
<field name="view_mode">graph,tree,pivot</field>
|
||||
<field name="search_view_id" ref="project_budget_hrs_report_view_search"/>
|
||||
<field name="context">{'search_default_group_by_project': 1,'search_default_sdate': 1,'search_default_edate': 1,'search_default_group_by_hours_type': 1, 'default_res_model': 'project.budget.hrs.report'}</field>
|
||||
<field name="context">{'search_default_group_by_project': 1,'search_default_sdate': 1,'search_default_edate': 1,'search_default_group_by_hours_type': 1, 'default_res_model': 'project.budget.hrs.report','search_default_notfixed':1}</field>
|
||||
</record>
|
||||
|
||||
<menuitem id="menu_project_budget_report_hrs_analysis"
|
||||
|
|
|
@ -8,7 +8,7 @@ class ProjectTimelineReport(models.Model):
|
|||
|
||||
_name = "project.timeline.report"
|
||||
_description = "Project Timeline Report"
|
||||
#_order = 'project_id'
|
||||
_order = 'project_id desc, timeline_type asc'
|
||||
_auto = False
|
||||
|
||||
#analytic_account_id = fields.Many2one('account.analytic.account', string='Analytic Account', readonly=True)
|
||||
|
@ -80,6 +80,7 @@ class ProjectTimelineReport(models.Model):
|
|||
Where
|
||||
PRO.active = 't'
|
||||
group by pro.id
|
||||
order by project_id desc, timeline_type asc
|
||||
) as res
|
||||
order by
|
||||
project_id desc,
|
||||
|
@ -87,7 +88,7 @@ class ProjectTimelineReport(models.Model):
|
|||
--end_date desc,
|
||||
--pricing_type,
|
||||
--project_type,
|
||||
timeline_type desc
|
||||
timeline_type asc
|
||||
--employee_id
|
||||
)""" % (self._table,))
|
||||
|
||||
|
|
|
@ -58,6 +58,7 @@
|
|||
<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')]"/>
|
||||
<filter string="Not Fixed rate" name="notfixed" domain="[('pricing_type','!=','fixed_rate')]"/>
|
||||
<!--<filter string="Sub Project" name="subproject" domain="[('is_sub_project','=',True)]"/>-->
|
||||
<group expand="1" string="Group By">
|
||||
<filter string="Project" name="group_by_project" context="{'group_by':'project_id'}"/>
|
||||
|
@ -77,7 +78,7 @@
|
|||
<field name="res_model">project.timeline.report</field>
|
||||
<field name="view_mode">graph,tree,pivot</field>
|
||||
<field name="search_view_id" ref="project_timeline_report_view_search"/>
|
||||
<field name="context">{'search_default_group_by_project': 1,'search_default_sdate': 1,'search_default_edate': 1,'search_default_group_by_timeline_type': 1, 'default_res_model':'project.timeline.report'}</field>
|
||||
<field name="context">{'search_default_group_by_project': 1, 'search_default_group_by_timeline_type': 1, 'search_default_notfixed':1, 'search_default_sdate': 1,'search_default_edate': 1, 'default_res_model':'project.timeline.report'}</field>
|
||||
</record>
|
||||
|
||||
<menuitem id="menu_project_timeline_report"
|
||||
|
|
|
@ -0,0 +1,81 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import fields, models, tools, api
|
||||
from datetime import datetime, time, timedelta
|
||||
from odoo.tools.float_utils import float_round
|
||||
|
||||
class ProjectTimelineReport(models.Model):
|
||||
|
||||
_name = "project.timesheet.report"
|
||||
_description = "Project Timesheet Report"
|
||||
_order = 'start_date desc, project_id desc'
|
||||
_auto = False
|
||||
|
||||
start_date = fields.Date(string='Start Date', readonly=True)
|
||||
employee_id = fields.Many2one('hr.employee', string='Employee', readonly=True)
|
||||
project_id = fields.Many2one('project.project', string='Project', readonly=True)
|
||||
#sub_project = fields.Many2one('project.project', string='Sub Project', readonly=True)
|
||||
duration = fields.Float('Duration', readonly=True)
|
||||
timestamp = fields.Char('Timestamp', readonly=True)
|
||||
task_id = fields.Many2one('project.task', string='Task', readonly=True)
|
||||
description = fields.Char('Description', readonly=True)
|
||||
sub_project = fields.Many2many('project.project', compute='_compute_related_subproject')
|
||||
|
||||
@api.depends('project_id')
|
||||
def _compute_related_subproject(self):
|
||||
for val in self:
|
||||
val.sub_project = val.project_id.sub_project.ids
|
||||
|
||||
@api.model
|
||||
def export_data(self, fields):
|
||||
index = range(len(fields))
|
||||
fields_name = dict(zip(fields, index))
|
||||
res = super(ProjectTimelineReport, self).export_data(fields)
|
||||
for index, val in enumerate(res['datas']):
|
||||
if fields_name.get('start_date') is not None:
|
||||
tdateindex = fields_name.get('start_date')
|
||||
tdate = res['datas'][index][tdateindex]
|
||||
if tdate:
|
||||
res['datas'][index][tdateindex] = datetime.strftime(tdate, "%d/%m/%Y")
|
||||
if fields_name.get('task_id') is not None:
|
||||
taskindex = fields_name.get('task_id')
|
||||
ttask = res['datas'][index][taskindex]
|
||||
if type(ttask) == bool:
|
||||
res['datas'][index][taskindex] = ''
|
||||
if fields_name.get('project_id') is not None:
|
||||
projectindex = fields_name.get('project_id')
|
||||
project = res['datas'][index][projectindex]
|
||||
if type(project) == bool:
|
||||
res['datas'][index][projectindex] = ''
|
||||
if fields_name.get('sub_project') is not None:
|
||||
subindex = fields_name.get('sub_project')
|
||||
subproject = res['datas'][index][subindex]
|
||||
if type(subproject) == bool:
|
||||
res['datas'][index][subindex] = ''
|
||||
if fields_name.get('duration') is not None:
|
||||
durationindex = fields_name.get('duration')
|
||||
duration = res['datas'][index][durationindex] and float(res['datas'][index][durationindex])
|
||||
if duration:
|
||||
duration_time = tools.format_duration(duration)
|
||||
res['datas'][index][durationindex] = duration_time
|
||||
return res
|
||||
|
||||
def init(self):
|
||||
'''Create the view'''
|
||||
tools.drop_view_if_exists(self._cr, self._table)
|
||||
self._cr.execute("""
|
||||
CREATE OR REPLACE VIEW %s AS (
|
||||
SELECT
|
||||
ROW_NUMBER() OVER() as id,
|
||||
start_datetime::date as start_date,
|
||||
employee_id,
|
||||
project_id,
|
||||
unit_amount as duration,
|
||||
CONCAT(to_char(start_datetime at time zone 'utc', 'HH24:MI'), '-', to_char(end_datetime at time zone 'utc', 'HH24:MI')) as timestamp,
|
||||
task_id,
|
||||
name as description
|
||||
from account_analytic_line
|
||||
)""" % (self._table,))
|
||||
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
|
||||
|
||||
<record id="project_timesheet_report_view_tree" model="ir.ui.view">
|
||||
<field name="name">project.timesheet.report.tree</field>
|
||||
<field name="model">project.timesheet.report</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Timesheet Report" create="false" edit="false" delete="false">
|
||||
<field name="start_date"/>
|
||||
<field name="employee_id"/>
|
||||
<field name="project_id"/>
|
||||
<field name="sub_project" widget="many2many_tags"/>
|
||||
<field name="task_id"/>
|
||||
<field name="duration" widget="float_time"/>
|
||||
<field name="timestamp"/>
|
||||
<field name="description"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="project_timesheet_report_view_search" model="ir.ui.view">
|
||||
<field name="name">project.timesheet.report.search</field>
|
||||
<field name="model">project.timesheet.report</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Timesheet Report">
|
||||
<field name="project_id"/>
|
||||
<field name="employee_id"/>
|
||||
<field name="start_date"/>
|
||||
<field name="task_id"/>
|
||||
<group expand="1" string="Group By">
|
||||
<filter string="Project" name="project" context="{'group_by':'project_id'}"/>
|
||||
<filter string="Employee" name="employee" context="{'group_by':'employee_id'}"/>
|
||||
<filter string="Start Date" name="sdate" domain="[]" context="{'group_by':'start_date:month'}"/>
|
||||
<filter string="Task" name="task" context="{'group_by':'task_id'}"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="project_timesheet_report_view_action" model="ir.actions.act_window">
|
||||
<field name="name">Timesheets Report</field>
|
||||
<field name="res_model">project.timesheet.report</field>
|
||||
<field name="view_mode">tree</field>
|
||||
<field name="search_view_id" ref="project_timesheet_report_view_search"/>
|
||||
<field name="context">{}</field>
|
||||
</record>
|
||||
|
||||
<menuitem id="menu_project_timesheets_report"
|
||||
parent="hr_timesheet.menu_timesheets_reports_timesheet"
|
||||
action="project_timesheet_report_view_action"
|
||||
name="Timesheets Report"
|
||||
sequence="50"/>
|
||||
|
||||
</odoo>
|
|
@ -6,4 +6,6 @@ access_project_budget_hrs_report_user,project.budget.hrs.report.user,model_proje
|
|||
access_project_budget_amt_report_user,project.budget.amt.report.user,model_project_budget_amt_report,project.group_project_user,1,0,0,0
|
||||
access_project_create_expense_user,access_project_create_expense_project_user,model_project_create_expense,project.group_project_user,1,0,0,0
|
||||
access_project_timeline_report_manager,project.timeline.report,model_project_timeline_report,project.group_project_manager,1,1,1,1
|
||||
access_project_timeline_report_user,project.timeline.report,model_project_timeline_report,project.group_project_user,1,0,0,0
|
||||
access_project_timeline_report_user,project.timeline.report,model_project_timeline_report,project.group_project_user,1,0,0,0
|
||||
access_project_timesheet_report_manager,project.timesheet.report,model_project_timesheet_report,project.group_project_manager,1,1,1,1
|
||||
access_project_timesheet_report_user,project.timesheet.report,model_project_timesheet_report,project.group_project_user,1,0,0,0
|
|
|
@ -145,7 +145,14 @@ var MAX_LEGEND_LENGTH = 25 * (1 + config.device.size_class);
|
|||
_getDatasetLabel: function (dataPt) {
|
||||
if (_.contains(['bar', 'horizontalBar', 'line'], this.state.mode)) {
|
||||
// ([origin] + second to last groupBys) or measure
|
||||
var datasetLabel = dataPt.labels.slice(1).join("/");
|
||||
//console.log("dataPt.labels", dataPt.labels, dataPt.labels.length, typeof dataPt.labels, self.resModel, this.resModel);
|
||||
if ((dataPt.labels.length > 2) && (this.resModel == 'project.timeline.report' || this.resModel == 'project.budget.hrs.report')) {
|
||||
var datasetLabel = dataPt.labels.slice(0).join("/");
|
||||
}
|
||||
else {
|
||||
var datasetLabel = dataPt.labels.slice(1).join("/");
|
||||
}
|
||||
//var datasetLabel = dataPt.labels.slice(0).join("/");
|
||||
if (this.state.origins.length > 1) {
|
||||
datasetLabel = this.state.origins[dataPt.originIndex] +
|
||||
(datasetLabel ? ('/' + datasetLabel) : '');
|
||||
|
@ -221,7 +228,8 @@ var MAX_LEGEND_LENGTH = 25 * (1 + config.device.size_class);
|
|||
} */
|
||||
}
|
||||
var label_res = dataset.label;
|
||||
if ((self.resModel == 'project.budget.hrs.report') || (self.resModel == 'project.timeline.report')) {
|
||||
//if ((self.resModel == 'project.budget.hrs.report') || (self.resModel == 'project.timeline.report')) {
|
||||
if (self.resModel == 'project.timeline.report') {
|
||||
var measure_value = self.fields[self.state.measure].string.split(" ").splice(-1);
|
||||
label_res = label_res.replace("Actual", "Actual " + measure_value).replace("Budgeted", "Budgeted " + measure_value);
|
||||
}
|
||||
|
@ -292,7 +300,13 @@ var MAX_LEGEND_LENGTH = 25 * (1 + config.device.size_class);
|
|||
if (this.state.mode === 'bar') {
|
||||
label = this._relabelling(label, dataset.originIndex);
|
||||
if (this.state.processedGroupBy.length > 1 || this.state.origins.length > 1) {
|
||||
label = label + "/" + dataset.label;
|
||||
if (this.resModel == 'project.timeline.report' || this.resModel == 'project.budget.hrs.report')
|
||||
{
|
||||
label = dataset.label;
|
||||
}
|
||||
else{
|
||||
label = label + "/" + dataset.label;
|
||||
}
|
||||
}
|
||||
value = this._formatValue(item.yLabel);
|
||||
boxColor = dataset.backgroundColor;
|
||||
|
@ -303,7 +317,13 @@ var MAX_LEGEND_LENGTH = 25 * (1 + config.device.size_class);
|
|||
} else if (this.state.mode === 'horizontalBar') {
|
||||
label = this._relabelling(label, dataset.originIndex);
|
||||
if (this.state.processedGroupBy.length > 1 || this.state.origins.length > 1) {
|
||||
label = label + "/" + dataset.label;
|
||||
if (this.resModel == 'project.timeline.report' || this.resModel == 'project.budget.hrs.report')
|
||||
{
|
||||
label = dataset.label;
|
||||
}
|
||||
else{
|
||||
label = label + "/" + dataset.label;
|
||||
}
|
||||
}
|
||||
value = this._formatValue(item.xLabel);
|
||||
boxColor = dataset.backgroundColor;
|
||||
|
@ -585,7 +605,27 @@ var MAX_LEGEND_LENGTH = 25 * (1 + config.device.size_class);
|
|||
var data = this._prepareData(dataPoints);
|
||||
|
||||
// this.title = 'Time Line';
|
||||
if ((self.resModel == 'project.budget.hrs.report') || (self.resModel == 'project.timeline.report')) {
|
||||
if (self.resModel == 'project.budget.hrs.report') {
|
||||
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]);
|
||||
var maxA = zipped_1.map((a) => {
|
||||
if ((!!a[0] && !!a[1]) && a[0] > a[1]) {
|
||||
return 'red';
|
||||
} else if ((!!a[0] && !!a[1]) && a[0] < a[1]) {
|
||||
return self._getColor(0);
|
||||
}
|
||||
else {
|
||||
return self._getColor(0);
|
||||
}
|
||||
});
|
||||
y[0].backgroundColor = maxA;
|
||||
y[1].backgroundColor = self._getColor(1);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (self.resModel == 'project.timeline.report') {
|
||||
var groupedData = _.groupBy(data.datasets, x => x.label.replace('Actual', '').replace('Budgeted', '').split("/")[0]);
|
||||
//var groupedData = _.groupBy(data.datasets, x => x.label.replace('Actual Hours', '').replace('Budgeted Hours', ''));
|
||||
_.map(groupedData, (y) => {
|
||||
|
@ -665,7 +705,14 @@ var MAX_LEGEND_LENGTH = 25 * (1 + config.device.size_class);
|
|||
/* if (self.state.stacked && dataset.label.includes("Actual")) {
|
||||
dataset.stack = 1;
|
||||
}*/
|
||||
if ((self.resModel == 'project.budget.hrs.report') || (self.resModel == 'project.timeline.report')) {
|
||||
if (self.resModel == 'project.budget.hrs.report') {
|
||||
if (dataset.label.indexOf("Actual Hours") === -1 && dataset.label.toLowerCase().indexOf("Budgeted Hours") === -1) {
|
||||
//if (dataset.label.indexOf("Actual") === -1 && dataset.label.toLowerCase().indexOf("Budgeted") === -1) {
|
||||
var color = self._getColor(index);
|
||||
dataset.backgroundColor = color;
|
||||
}
|
||||
}
|
||||
else if (self.resModel == 'project.timeline.report') {
|
||||
//if (dataset.label.indexOf("Actual Hours") === -1 && dataset.label.toLowerCase().indexOf("Budgeted Hours") === -1) {
|
||||
if (dataset.label.indexOf("Actual") === -1 && dataset.label.toLowerCase().indexOf("Budgeted") === -1) {
|
||||
var color = self._getColor(index);
|
||||
|
@ -724,7 +771,30 @@ var MAX_LEGEND_LENGTH = 25 * (1 + config.device.size_class);
|
|||
|
||||
//console.log("datappppppppppp", dataPoints);
|
||||
|
||||
if ((self.resModel == 'project.budget.hrs.report') || (self.resModel == 'project.timeline.report')) {
|
||||
if (self.resModel == 'project.budget.hrs.report') {
|
||||
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', '').replace('Budgeted', '').split("/")[0]);
|
||||
_.map(groupedData, (y) => {
|
||||
if (y.length > 1) {
|
||||
var zipped_1 = _.zip.apply(null, [y[0].data, y[1].data]);
|
||||
var maxA = zipped_1.map((a) => {
|
||||
if ((!!a[0] && !!a[1]) && a[0] > a[1]) {
|
||||
return 'red';
|
||||
} else if ((!!a[0] && !!a[1]) && a[0] < a[1]) {
|
||||
return self._getColor(0);
|
||||
}
|
||||
else {
|
||||
return self._getColor(0);
|
||||
}
|
||||
});
|
||||
y[0].backgroundColor = maxA;
|
||||
y[1].backgroundColor = self._getColor(1);
|
||||
//var zipped_2 = _.zip.apply(null, [y[1].data, y[0].data]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (self.resModel == 'project.timeline.report') {
|
||||
//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', '').replace('Budgeted', '').split("/")[0]);
|
||||
_.map(groupedData, (y) => {
|
||||
|
@ -742,7 +812,7 @@ var MAX_LEGEND_LENGTH = 25 * (1 + config.device.size_class);
|
|||
});
|
||||
y[0].backgroundColor = maxA;
|
||||
y[1].backgroundColor = self._getColor(1);
|
||||
var zipped_2 = _.zip.apply(null, [y[1].data, y[0].data]);
|
||||
//var zipped_2 = _.zip.apply(null, [y[1].data, y[0].data]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -797,7 +867,13 @@ var MAX_LEGEND_LENGTH = 25 * (1 + config.device.size_class);
|
|||
/*if (self.state.stacked && dataset.label.includes("Actual")) {
|
||||
dataset.stack = 1;
|
||||
}*/
|
||||
if ((self.resModel == 'project.budget.hrs.report') || (self.resModel == 'project.timeline.report')) {
|
||||
if (self.resModel == 'project.budget.hrs.report') {
|
||||
if (dataset.label.indexOf("Actual Hours") === -1 && dataset.label.toLowerCase().indexOf("Budgeted Hours") === -1) {
|
||||
var color = self._getColor(index);
|
||||
dataset.backgroundColor = color;
|
||||
}
|
||||
}
|
||||
else if (self.resModel == 'project.timeline.report') {
|
||||
if (dataset.label.indexOf("Actual") === -1 && dataset.label.toLowerCase().indexOf("Budgeted") === -1) {
|
||||
var color = self._getColor(index);
|
||||
dataset.backgroundColor = color;
|
||||
|
|
Loading…
Reference in New Issue