diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2022-05-10 21:51:50 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2022-05-10 21:51:50 +0700 |
| commit | 3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch) | |
| tree | a44932296ef4a9b71d5f010906253d8c53727726 /addons/project/static/src/js/project_rating_reporting.js | |
| parent | 0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff) | |
initial commit 2
Diffstat (limited to 'addons/project/static/src/js/project_rating_reporting.js')
| -rw-r--r-- | addons/project/static/src/js/project_rating_reporting.js | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/addons/project/static/src/js/project_rating_reporting.js b/addons/project/static/src/js/project_rating_reporting.js new file mode 100644 index 00000000..8e393c67 --- /dev/null +++ b/addons/project/static/src/js/project_rating_reporting.js @@ -0,0 +1,69 @@ +odoo.define('project.project_rating_reporting', function (require) { +'use strict'; + +const core = require('web.core'); +const _t = core._t; + +const viewRegistry = require('web.view_registry'); + +const PivotController = require('web.PivotController'); +const PivotView = require('web.PivotView'); + +const GraphController = require('web.GraphController'); +const GraphView = require('web.GraphView'); + +var ProjectPivotController = PivotController.extend({ + /** + * @override + */ + init: function () { + this._super.apply(this, arguments); + var measures = JSON.parse(JSON.stringify(this.measures)); + if ('res_id' in measures) { + measures.res_id.string = _t('Task'); + } + if ('parent_res_id' in measures) { + measures.parent_res_id.string = _t('Project'); + } + if ('rating' in measures) { + measures.rating.string = _t('Rating Value (/5)'); + } + this.measures = measures; + }, +}); + +var ProjectPivotView = PivotView.extend({ + config: _.extend({}, PivotView.prototype.config, { + Controller: ProjectPivotController, + }), +}); + +viewRegistry.add('project_rating_pivot', ProjectPivotView); + +var ProjectGraphController = GraphController.extend({ + /** + * @override + */ + init: function () { + this._super.apply(this, arguments); + _.each(this.measures, measure => { + if (measure.fieldName === 'res_id') { + measure.description = _t('Task'); + } else if (measure.fieldName === 'parent_res_id') { + measure.description = _t('Project'); + } else if (measure.fieldName === 'rating') { + measure.description = _t('Rating Value (/5)'); + } + }); + }, +}); + +var ProjectGraphView = GraphView.extend({ + config: _.extend({}, GraphView.prototype.config, { + Controller: ProjectGraphController, + }), +}); + +viewRegistry.add('project_rating_graph', ProjectGraphView); + +}); |
