summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views/graph/graph_model.js
diff options
context:
space:
mode:
authorRomainLibert <rli@odoo.com>2018-08-01 15:41:02 +0200
committerRomainLibert <rli@odoo.com>2018-08-02 11:41:42 +0200
commit01f6a0257ddf6cf581e588d0279d06af8556cc5a (patch)
treec672d0a57d3ec0b80343614ed91c9ed5147a1e01 /addons/web/static/src/js/views/graph/graph_model.js
parent2cbdf1b4ad1523184ee2957966d51fb220ae3217 (diff)
[FIX] web: use fieldName instead of field in _sanitizeValue
In _sanitizeValue we can receive field as a string of the form fieldName:grouping, if we search for this directly in the fields of the model we won't find anything. Hence we should use the fieldName part of it.
Diffstat (limited to 'addons/web/static/src/js/views/graph/graph_model.js')
-rw-r--r--addons/web/static/src/js/views/graph/graph_model.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/addons/web/static/src/js/views/graph/graph_model.js b/addons/web/static/src/js/views/graph/graph_model.js
index eb831d5047a..3c1d26ea252 100644
--- a/addons/web/static/src/js/views/graph/graph_model.js
+++ b/addons/web/static/src/js/views/graph/graph_model.js
@@ -202,10 +202,11 @@ return AbstractModel.extend({
* @returns {string}
*/
_sanitizeValue: function (value, field) {
- if (value === false && this.fields[field].type !== 'boolean') return _t("Undefined");
+ var fieldName = field.split(':')[0];
+ if (value === false && this.fields[fieldName].type !== 'boolean') return _t("Undefined");
if (value instanceof Array) return value[1];
- if (field && this.fields[field] && (this.fields[field].type === 'selection')) {
- var selected = _.where(this.fields[field].selection, {0: value})[0];
+ if (field && (this.fields[fieldName].type === 'selection')) {
+ var selected = _.where(this.fields[fieldName].selection, {0: value})[0];
return selected ? selected[1] : value;
}
return value;