Skip to content

Commit

Permalink
Merge PR OCA#2361 into 15.0
Browse files Browse the repository at this point in the history
Signed-off-by legalsylvain
  • Loading branch information
OCA-git-bot committed Jan 28, 2024
2 parents edde915 + baa7cd2 commit 706527c
Showing 1 changed file with 4 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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"
: ""
);
},

Expand Down Expand Up @@ -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
*
Expand Down

0 comments on commit 706527c

Please sign in to comment.