mirror of https://github.com/OCA/web.git
[FIX] web_widget_x2many_2d_matrix: fix totals option
Also refactored to use underscore method rather than redefining a similar one.pull/2361/head
parent
c764f2d8f2
commit
baa7cd2bf2
|
@ -39,8 +39,8 @@ odoo.define("web_widget_x2many_2d_matrix.widget", function (require) {
|
|||
this.field_y_axis = node.field_y_axis || this.field_y_axis;
|
||||
this.field_label_x_axis = node.field_label_x_axis || this.field_x_axis;
|
||||
this.field_label_y_axis = node.field_label_y_axis || this.field_y_axis;
|
||||
this.x_axis_clickable = this.parse_boolean(node.x_axis_clickable || "1");
|
||||
this.y_axis_clickable = this.parse_boolean(node.y_axis_clickable || "1");
|
||||
this.x_axis_clickable = _.str.toBool(node.x_axis_clickable || "1");
|
||||
this.y_axis_clickable = _.str.toBool(node.y_axis_clickable || "1");
|
||||
this.field_value = node.field_value || this.field_value;
|
||||
// TODO: is this really needed? Holger?
|
||||
for (var property in node) {
|
||||
|
@ -59,17 +59,13 @@ odoo.define("web_widget_x2many_2d_matrix.widget", function (require) {
|
|||
)
|
||||
);
|
||||
}
|
||||
this.show_row_totals = this.parse_boolean(
|
||||
this.show_row_totals = _.str.toBool(
|
||||
node.show_row_totals ||
|
||||
this.is_aggregatable(field_defs[this.field_value])
|
||||
? "1"
|
||||
: ""
|
||||
);
|
||||
this.show_column_totals = this.parse_boolean(
|
||||
this.show_column_totals = _.str.toBool(
|
||||
node.show_column_totals ||
|
||||
this.is_aggregatable(field_defs[this.field_value])
|
||||
? "1"
|
||||
: ""
|
||||
);
|
||||
},
|
||||
|
||||
|
@ -183,19 +179,6 @@ odoo.define("web_widget_x2many_2d_matrix.widget", function (require) {
|
|||
return field_def.type in {float: 1, monetary: 1, integer: 1};
|
||||
},
|
||||
|
||||
/**
|
||||
* Parse a String containing a bool and convert it to a JS bool.
|
||||
*
|
||||
* @param {String} val: the string to be parsed.
|
||||
* @returns {Boolean} The parsed boolean.
|
||||
*/
|
||||
parse_boolean: function (val) {
|
||||
if (val.toLowerCase() === "true" || val === "1") {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* Create the matrix renderer and add its output to our element
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue