Timeline order by and label updated

This commit is contained in:
projectsodoo 2021-03-02 23:20:09 +05:30
parent 6fbf3380c0
commit 0d09f22f27
3 changed files with 11 additions and 8 deletions

View File

@ -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,))

View File

@ -78,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', 'search_default_notfixed':1}</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"

View File

@ -145,7 +145,8 @@ 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("/");
//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) : '');
@ -294,6 +295,7 @@ var MAX_LEGEND_LENGTH = 25 * (1 + config.device.size_class);
label = this._relabelling(label, dataset.originIndex);
if (this.state.processedGroupBy.length > 1 || this.state.origins.length > 1) {
label = label + "/" + dataset.label;
label = dataset.label;
}
value = this._formatValue(item.yLabel);
boxColor = dataset.backgroundColor;
@ -304,7 +306,8 @@ 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;
//label = label + "/" + dataset.label;
label = dataset.label;
}
value = this._formatValue(item.xLabel);
boxColor = dataset.backgroundColor;
@ -770,7 +773,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]);
}
});
}
@ -778,7 +781,6 @@ var MAX_LEGEND_LENGTH = 25 * (1 + config.device.size_class);
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]);
console.log("groupedData ", groupedData);
_.map(groupedData, (y) => {
if (y.length > 1) {
var zipped_1 = _.zip.apply(null, [y[0].data, y[1].data]);
@ -794,7 +796,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]);
}
});
}