I want to change this total label to "Average", How it could be possible ?
-------------------------------------------------------------------------EDIT----------------------------------------------------------------------------------------------
@Axel :
Here is the error : JS test results raising error
And Here is my code :
__openerp__.py
{ 'name''HR appraisals advanced management (Survey enhancements included)': ,
'description':'Advanced appraisals management' ,
'author':'Yassine TEIMI ,
'depends': ['hr_evaluation','survey','web_graph'],
'data': ['views/survey_templates.xml','views/survey_result.xml','report/hr_evaluation_report_extension_view.xml','static/src/xml/assets_backend.xml'],
}
change_total_label.js :
(function () {
'use strict';
var _lt = openerp.web._lt;
var _t = openerp.web._t;
openerp.web_graph.PivotTable.include({
find_or_create_header: function (headers, path, data_pt) {
var self = this;
var hdr = _.find(headers, function (header) {
return self.isEqual(path, header.path);
});
if (hdr) {
return hdr;
}
if (!path.length) {
var pivot_header = 'Total';
if(self.context.pivot_header != undefined){
pivot_header = self.context.pivot_header;
}
hdr = this.make_header({title: _t(pivot_header)});
headers.push(hdr);
return hdr;
}
hdr = this.make_header({
path:path,
domain:data_pt.model._domain,
title: _t(_.last(path))
});
var parent = _.find(headers, function (header) {
return self.isEqual(header.path, _.initial(path, 1));
});
var previous = parent.children.length ? _.last(parent.children) : parent;
headers.splice(headers.indexOf(previous) + 1, 0, hdr);
parent.children.push(hdr);
return hdr;
},
});
})();
assets_backend.xml :
<template id="assets_backend" name="web_graph assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript" src="/hr_appraisals_adv/static/src/js/change_total_label.js"></script>
</xpath>
</template>
my reporting action, where I need to passe the pivot header :
<record id="action_evaluation_goals_reaching" model="ir.actions.act_window">
<field name="name">Atteinte des objectifs</field>
<field name="res_model">hr.evaluation.report.goals</field>
<field name="view_type">form</field>
<field name="view_mode">graph</field>
<field name="search_view_id" ref="view_goals_reaching_search"/>
<field name="context">{'pivot_header': 'Moyenne'}</field> <!-- just added here the label in french -->
</record>