[IMP] web_widget_x2many_2d_matrix: black, isort, prettier

pull/2110/head
Saran440 2020-11-13 10:26:26 +07:00 committed by Lois Rilo
parent 83c3b860c1
commit c04bbcb411
4 changed files with 61 additions and 66 deletions

View File

@ -2,7 +2,7 @@
* Copyright 2018 Brainbean Apps * Copyright 2018 Brainbean Apps
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */ * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */
odoo.define("web_widget_x2many_2d_matrix.X2Many2dMatrixRenderer", function(require) { odoo.define("web_widget_x2many_2d_matrix.X2Many2dMatrixRenderer", function (require) {
"use strict"; "use strict";
var BasicRenderer = require("web.BasicRenderer"); var BasicRenderer = require("web.BasicRenderer");
@ -25,7 +25,7 @@ odoo.define("web_widget_x2many_2d_matrix.X2Many2dMatrixRenderer", function(requi
/** /**
* @override * @override
*/ */
init: function(parent, state, params) { init: function (parent, state, params) {
this._super.apply(this, arguments); this._super.apply(this, arguments);
this.editable = params.editable; this.editable = params.editable;
this._saveMatrixData(params.matrix_data); this._saveMatrixData(params.matrix_data);
@ -36,7 +36,7 @@ odoo.define("web_widget_x2many_2d_matrix.X2Many2dMatrixRenderer", function(requi
* *
* @param {Object} matrixData Contains the matrix data * @param {Object} matrixData Contains the matrix data
*/ */
_saveMatrixData: function(matrixData) { _saveMatrixData: function (matrixData) {
this.columns = matrixData.columns; this.columns = matrixData.columns;
this.rows = matrixData.rows; this.rows = matrixData.rows;
this.matrix_data = matrixData; this.matrix_data = matrixData;
@ -52,7 +52,7 @@ odoo.define("web_widget_x2many_2d_matrix.X2Many2dMatrixRenderer", function(requi
* @private * @private
* @returns {Deferred} this deferred is resolved immediately * @returns {Deferred} this deferred is resolved immediately
*/ */
_renderView: function() { _renderView: function () {
var self = this; var self = this;
this.$el.removeClass("table-responsive").empty(); this.$el.removeClass("table-responsive").empty();
@ -96,9 +96,9 @@ odoo.define("web_widget_x2many_2d_matrix.X2Many2dMatrixRenderer", function(requi
* @private * @private
* @returns {jQueryElement} The table body element just filled. * @returns {jQueryElement} The table body element just filled.
*/ */
_renderBody: function() { _renderBody: function () {
var $body = $("<tbody>").append(this._renderRows()); var $body = $("<tbody>").append(this._renderRows());
_.each($body.find("input"), function(td, i) { _.each($body.find("input"), function (td, i) {
$(td).attr("tabindex", i); $(td).attr("tabindex", i);
}); });
return $body; return $body;
@ -111,7 +111,7 @@ odoo.define("web_widget_x2many_2d_matrix.X2Many2dMatrixRenderer", function(requi
* @private * @private
* @returns {jQueryElement} The thead element that was inserted into. * @returns {jQueryElement} The thead element that was inserted into.
*/ */
_renderHeader: function() { _renderHeader: function () {
var $tr = $("<tr>").append("<th/>"); var $tr = $("<tr>").append("<th/>");
$tr = $tr.append(_.map(this.columns, this._renderHeaderCell.bind(this))); $tr = $tr.append(_.map(this.columns, this._renderHeaderCell.bind(this)));
if (this.matrix_data.show_row_totals) { if (this.matrix_data.show_row_totals) {
@ -129,7 +129,7 @@ odoo.define("web_widget_x2many_2d_matrix.X2Many2dMatrixRenderer", function(requi
* @param {jQueryElement} node * @param {jQueryElement} node
* @returns {jQueryElement} the created <th> node. * @returns {jQueryElement} the created <th> node.
*/ */
_renderHeaderCell: function(node) { _renderHeaderCell: function (node) {
var name = node.attrs.name; var name = node.attrs.name;
var field = this.state.fields[name]; var field = this.state.fields[name];
var $th = $("<th>"); var $th = $("<th>");
@ -175,10 +175,10 @@ odoo.define("web_widget_x2many_2d_matrix.X2Many2dMatrixRenderer", function(requi
* @private * @private
* @returns {String} a string with the generated html. * @returns {String} a string with the generated html.
*/ */
_renderRows: function() { _renderRows: function () {
return _.map( return _.map(
this.rows, this.rows,
function(row) { function (row) {
row.attrs.name = this.matrix_data.field_value; row.attrs.name = this.matrix_data.field_value;
return this._renderRow(row); return this._renderRow(row);
}.bind(this) }.bind(this)
@ -195,12 +195,12 @@ odoo.define("web_widget_x2many_2d_matrix.X2Many2dMatrixRenderer", function(requi
* @param {Object} row The row that will be rendered. * @param {Object} row The row that will be rendered.
* @returns {jQueryElement} the <tr> element that has been rendered. * @returns {jQueryElement} the <tr> element that has been rendered.
*/ */
_renderRow: function(row) { _renderRow: function (row) {
var $tr = $("<tr/>", {class: "o_data_row"}), var $tr = $("<tr/>", {class: "o_data_row"}),
_data = _.without(row.data, undefined); _data = _.without(row.data, undefined);
$tr = $tr.append(this._renderLabelCell(_data[0])); $tr = $tr.append(this._renderLabelCell(_data[0]));
var $cells = this.columns.map( var $cells = this.columns.map(
function(column, index) { function (column, index) {
var record = row.data[index]; var record = row.data[index];
// Make the widget use our field value for each cell // Make the widget use our field value for each cell
column.attrs.name = this.matrix_data.field_value; column.attrs.name = this.matrix_data.field_value;
@ -221,7 +221,7 @@ odoo.define("web_widget_x2many_2d_matrix.X2Many2dMatrixRenderer", function(requi
* @param {Object} record Contains the information about the record. * @param {Object} record Contains the information about the record.
* @returns {jQueryElement} the cell that was rendered. * @returns {jQueryElement} the cell that was rendered.
*/ */
_renderLabelCell: function(record) { _renderLabelCell: function (record) {
var $td = $("<td>"); var $td = $("<td>");
var value = record.data[this.matrix_data.field_y_axis]; var value = record.data[this.matrix_data.field_y_axis];
if (value.type === "record") { if (value.type === "record") {
@ -240,7 +240,7 @@ odoo.define("web_widget_x2many_2d_matrix.X2Many2dMatrixRenderer", function(requi
* @param {Object} row the row object to aggregate. * @param {Object} row the row object to aggregate.
* @returns {jQueryElement} The rendered cell. * @returns {jQueryElement} The rendered cell.
*/ */
_renderAggregateRowCell: function(row) { _renderAggregateRowCell: function (row) {
var $cell = $("<td/>", {class: "row-total"}); var $cell = $("<td/>", {class: "row-total"});
this.applyAggregateValue($cell, row); this.applyAggregateValue($cell, row);
return $cell; return $cell;
@ -258,7 +258,7 @@ odoo.define("web_widget_x2many_2d_matrix.X2Many2dMatrixRenderer", function(requi
* @param {Object} options The obtions used for the widget * @param {Object} options The obtions used for the widget
* @returns {jQueryElement} the rendered cell. * @returns {jQueryElement} the rendered cell.
*/ */
_renderBodyCell: function(record, node, colIndex, options) { _renderBodyCell: function (record, node, colIndex, options) {
var tdClassName = "o_data_cell"; var tdClassName = "o_data_cell";
if (node.tag === "field") { if (node.tag === "field") {
var typeClass = FIELD_CLASSES[this.state.fields[node.attrs.name].type]; var typeClass = FIELD_CLASSES[this.state.fields[node.attrs.name].type];
@ -317,12 +317,10 @@ odoo.define("web_widget_x2many_2d_matrix.X2Many2dMatrixRenderer", function(requi
* @private * @private
* @returns {jQueryElement} The footer element with the cells in it. * @returns {jQueryElement} The footer element with the cells in it.
*/ */
_renderFooter: function() { _renderFooter: function () {
var $cells = this._renderAggregateColCells(); var $cells = this._renderAggregateColCells();
if ($cells) { if ($cells) {
var $tr = $("<tr>") var $tr = $("<tr>").append("<td/>").append($cells);
.append("<td/>")
.append($cells);
var $total_cell = this._renderTotalCell(); var $total_cell = this._renderTotalCell();
if ($total_cell) { if ($total_cell) {
$tr.append($total_cell); $tr.append($total_cell);
@ -337,7 +335,7 @@ odoo.define("web_widget_x2many_2d_matrix.X2Many2dMatrixRenderer", function(requi
* @private * @private
* @returns {jQueryElement} The td element with the total in it. * @returns {jQueryElement} The td element with the total in it.
*/ */
_renderTotalCell: function() { _renderTotalCell: function () {
if ( if (
!this.matrix_data.show_column_totals || !this.matrix_data.show_column_totals ||
!this.matrix_data.show_row_totals !this.matrix_data.show_row_totals
@ -356,10 +354,10 @@ odoo.define("web_widget_x2many_2d_matrix.X2Many2dMatrixRenderer", function(requi
* @private * @private
* @returns {List} the rendered cells * @returns {List} the rendered cells
*/ */
_renderAggregateColCells: function() { _renderAggregateColCells: function () {
var self = this; var self = this;
return _.map(this.columns, function(column) { return _.map(this.columns, function (column) {
var $cell = $("<td>"); var $cell = $("<td>");
if (config.isDebug()) { if (config.isDebug()) {
$cell.addClass(column.attrs.name); $cell.addClass(column.attrs.name);
@ -377,7 +375,7 @@ odoo.define("web_widget_x2many_2d_matrix.X2Many2dMatrixRenderer", function(requi
* *
* @private * @private
*/ */
_computeColumnAggregates: function() { _computeColumnAggregates: function () {
if (!this.matrix_data.show_column_totals) { if (!this.matrix_data.show_column_totals) {
return; return;
} }
@ -401,12 +399,12 @@ odoo.define("web_widget_x2many_2d_matrix.X2Many2dMatrixRenderer", function(requi
}; };
_.each( _.each(
this.columns, this.columns,
function(column, index) { function (column, index) {
column.aggregate = { column.aggregate = {
help: _t("Sum"), help: _t("Sum"),
value: 0, value: 0,
}; };
_.each(this.rows, function(row) { _.each(this.rows, function (row) {
// TODO Use only one _.propertyOf in underscore 1.9.0+ // TODO Use only one _.propertyOf in underscore 1.9.0+
try { try {
column.aggregate.value += row.data[index].data[fname]; column.aggregate.value += row.data[index].data[fname];
@ -419,9 +417,9 @@ odoo.define("web_widget_x2many_2d_matrix.X2Many2dMatrixRenderer", function(requi
); );
}, },
_getRecord: function(recordId) { _getRecord: function (recordId) {
var record = null; var record = null;
utils.traverse_records(this.state, function(r) { utils.traverse_records(this.state, function (r) {
if (r.id === recordId) { if (r.id === recordId) {
record = r; record = r;
} }
@ -432,7 +430,7 @@ odoo.define("web_widget_x2many_2d_matrix.X2Many2dMatrixRenderer", function(requi
/** /**
* @override * @override
*/ */
updateState: function(state, params) { updateState: function (state, params) {
if (params.matrix_data) { if (params.matrix_data) {
this._saveMatrixData(params.matrix_data); this._saveMatrixData(params.matrix_data);
} }
@ -446,7 +444,7 @@ odoo.define("web_widget_x2many_2d_matrix.X2Many2dMatrixRenderer", function(requi
* @private * @private
* @param {OdooEvent} event "navigation_move" event * @param {OdooEvent} event "navigation_move" event
*/ */
_onNavigationMove: function(event) { _onNavigationMove: function (event) {
var widgets = this.__parentedChildren, var widgets = this.__parentedChildren,
index = widgets.indexOf(event.target), index = widgets.indexOf(event.target),
first = index === 0, first = index === 0,
@ -474,7 +472,7 @@ odoo.define("web_widget_x2many_2d_matrix.X2Many2dMatrixRenderer", function(requi
* *
* @private * @private
*/ */
_computeRowAggregates: function() { _computeRowAggregates: function () {
if (!this.matrix_data.show_row_totals) { if (!this.matrix_data.show_row_totals) {
return; return;
} }
@ -487,12 +485,12 @@ odoo.define("web_widget_x2many_2d_matrix.X2Many2dMatrixRenderer", function(requi
if (!~["integer", "float", "monetary"].indexOf(type)) { if (!~["integer", "float", "monetary"].indexOf(type)) {
return; return;
} }
_.each(this.rows, function(row) { _.each(this.rows, function (row) {
row.aggregate = { row.aggregate = {
help: _t("Sum"), help: _t("Sum"),
value: 0, value: 0,
}; };
_.each(row.data, function(col) { _.each(row.data, function (col) {
// TODO Use _.property in underscore 1.9+ // TODO Use _.property in underscore 1.9+
try { try {
row.aggregate.value += col.data[fname]; row.aggregate.value += col.data[fname];
@ -514,7 +512,7 @@ odoo.define("web_widget_x2many_2d_matrix.X2Many2dMatrixRenderer", function(requi
* @param {Object} axis * @param {Object} axis
* The object which contains the information about the aggregate value axis * The object which contains the information about the aggregate value axis
*/ */
applyAggregateValue: function($cell, axis) { applyAggregateValue: function ($cell, axis) {
var field = this.state.fields[axis.attrs.name]; var field = this.state.fields[axis.attrs.name];
var value = axis.aggregate.value; var value = axis.aggregate.value;
var help = axis.aggregate.help; var help = axis.aggregate.help;
@ -522,10 +520,7 @@ odoo.define("web_widget_x2many_2d_matrix.X2Many2dMatrixRenderer", function(requi
var formatFunc = var formatFunc =
field_utils.format[fieldInfo.widget ? fieldInfo.widget : field.type]; field_utils.format[fieldInfo.widget ? fieldInfo.widget : field.type];
var formattedValue = formatFunc(value, field, {escape: true}); var formattedValue = formatFunc(value, field, {escape: true});
$cell $cell.addClass("o_list_number").attr("title", help).html(formattedValue);
.addClass("o_list_number")
.attr("title", help)
.html(formattedValue);
}, },
/** /**
@ -547,10 +542,10 @@ odoo.define("web_widget_x2many_2d_matrix.X2Many2dMatrixRenderer", function(requi
* @returns {Deferred} * @returns {Deferred}
* The deferred object thats gonna be resolved when the change is made. * The deferred object thats gonna be resolved when the change is made.
*/ */
confirmUpdate: function(state, id, fields, ev) { confirmUpdate: function (state, id, fields, ev) {
var self = this; var self = this;
this.state = state; this.state = state;
return this.confirmChange(state, id, fields, ev).then(function() { return this.confirmChange(state, id, fields, ev).then(function () {
self._refresh(id); self._refresh(id);
}); });
}, },
@ -561,7 +556,7 @@ odoo.define("web_widget_x2many_2d_matrix.X2Many2dMatrixRenderer", function(requi
* @private * @private
* @param {String} id Datapoint ID * @param {String} id Datapoint ID
*/ */
_refresh: function(id) { _refresh: function (id) {
this._updateRow(id); this._updateRow(id);
this._refreshColTotals(); this._refreshColTotals();
this._refreshRowTotals(); this._refreshRowTotals();
@ -572,11 +567,11 @@ odoo.define("web_widget_x2many_2d_matrix.X2Many2dMatrixRenderer", function(requi
* *
* @param {String} id: The id of the row that needs to be updated. * @param {String} id: The id of the row that needs to be updated.
*/ */
_updateRow: function(id) { _updateRow: function (id) {
var record = _.findWhere(this.state.data, {id: id}), var record = _.findWhere(this.state.data, {id: id}),
_id = _.property("id"); _id = _.property("id");
_.each(this.rows, function(row) { _.each(this.rows, function (row) {
_.each(row.data, function(col, i) { _.each(row.data, function (col, i) {
if (_id(col) === id) { if (_id(col) === id) {
row.data[i] = record; row.data[i] = record;
} }
@ -587,7 +582,7 @@ odoo.define("web_widget_x2many_2d_matrix.X2Many2dMatrixRenderer", function(requi
/** /**
* Update the row total. * Update the row total.
*/ */
_refreshColTotals: function() { _refreshColTotals: function () {
this._computeColumnAggregates(); this._computeColumnAggregates();
this.$("tfoot").replaceWith(this._renderFooter()); this.$("tfoot").replaceWith(this._renderFooter());
}, },
@ -595,11 +590,11 @@ odoo.define("web_widget_x2many_2d_matrix.X2Many2dMatrixRenderer", function(requi
/** /**
* Update the column total. * Update the column total.
*/ */
_refreshRowTotals: function() { _refreshRowTotals: function () {
var self = this; var self = this;
this._computeRowAggregates(); this._computeRowAggregates();
var $rows = self.$el.find("tr.o_data_row"); var $rows = self.$el.find("tr.o_data_row");
_.each(self.rows, function(row, i) { _.each(self.rows, function (row, i) {
if (row.aggregate) { if (row.aggregate) {
$($rows[i]) $($rows[i])
.find(".row-total") .find(".row-total")
@ -613,7 +608,7 @@ odoo.define("web_widget_x2many_2d_matrix.X2Many2dMatrixRenderer", function(requi
* *
* @returns {null} * @returns {null}
*/ */
getEditableRecordID: function() { getEditableRecordID: function () {
return null; return null;
}, },
}); });

View File

@ -1,13 +1,13 @@
/* Copyright 2019 Alexandre Díaz /* Copyright 2019 Alexandre Díaz
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */ * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */
odoo.define("web_widget_x2many_2d_matrix.X2Many2dMatrixView", function(require) { odoo.define("web_widget_x2many_2d_matrix.X2Many2dMatrixView", function (require) {
"use strict"; "use strict";
var BasicView = require("web.BasicView"); var BasicView = require("web.BasicView");
BasicView.include({ BasicView.include({
_processField: function(viewType, field, attrs) { _processField: function (viewType, field, attrs) {
// Workaround for kanban mode rendering. // Workaround for kanban mode rendering.
// Source of the issue: https://github.com/OCA/OCB/blob/12.0/addons/web/static/src/js/views/basic/basic_view.js#L303 . // Source of the issue: https://github.com/OCA/OCB/blob/12.0/addons/web/static/src/js/views/basic/basic_view.js#L303 .
// See https://github.com/OCA/web/pull/1404#pullrequestreview-305813206 . // See https://github.com/OCA/web/pull/1404#pullrequestreview-305813206 .

View File

@ -1,4 +1,4 @@
odoo.define("web_widget_x2many_2d_matrix.matrix_limit_extend", function(require) { odoo.define("web_widget_x2many_2d_matrix.matrix_limit_extend", function (require) {
"use strict"; "use strict";
var FormView = require("web.FormView"); var FormView = require("web.FormView");
@ -6,7 +6,7 @@ odoo.define("web_widget_x2many_2d_matrix.matrix_limit_extend", function(require)
FormView.include({ FormView.include({
// We extend this method so that the view is not limited to // We extend this method so that the view is not limited to
// just 40 cells when the 'x2many_2d_matrix' widget is used. // just 40 cells when the 'x2many_2d_matrix' widget is used.
_setSubViewLimit: function(attrs) { _setSubViewLimit: function (attrs) {
this._super(attrs); this._super(attrs);
if (attrs.widget === "x2many_2d_matrix") { if (attrs.widget === "x2many_2d_matrix") {
attrs.limit = Infinity; attrs.limit = Infinity;

View File

@ -3,7 +3,7 @@
* Copyright 2018 Simone Orsi <simone.orsi@camptocamp.com> * Copyright 2018 Simone Orsi <simone.orsi@camptocamp.com>
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */ * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */
odoo.define("web_widget_x2many_2d_matrix.widget", function(require) { odoo.define("web_widget_x2many_2d_matrix.widget", function (require) {
"use strict"; "use strict";
var field_registry = require("web.field_registry"); var field_registry = require("web.field_registry");
@ -21,7 +21,7 @@ odoo.define("web_widget_x2many_2d_matrix.widget", function(require) {
* @param {Object} record information about the database records. * @param {Object} record information about the database records.
* @param {Object} options view options. * @param {Object} options view options.
*/ */
init: function(parent, name, record, options) { init: function (parent, name, record, options) {
this._super(parent, name, record, options); this._super(parent, name, record, options);
this.init_params(); this.init_params();
}, },
@ -30,7 +30,7 @@ odoo.define("web_widget_x2many_2d_matrix.widget", function(require) {
* Initialize the widget specific parameters. * Initialize the widget specific parameters.
* Sets the axis and the values. * Sets the axis and the values.
*/ */
init_params: function() { init_params: function () {
var node = this.attrs; var node = this.attrs;
this.by_y_axis = {}; this.by_y_axis = {};
this.x_axis = []; this.x_axis = [];
@ -79,7 +79,7 @@ odoo.define("web_widget_x2many_2d_matrix.widget", function(require) {
* Puts the values in the grid. * Puts the values in the grid.
* If we have related items we use the display name. * If we have related items we use the display name.
*/ */
init_matrix: function() { init_matrix: function () {
var records = this.recordData[this.name].data; var records = this.recordData[this.name].data;
// Wipe the content if something still exists // Wipe the content if something still exists
this.by_y_axis = {}; this.by_y_axis = {};
@ -87,7 +87,7 @@ odoo.define("web_widget_x2many_2d_matrix.widget", function(require) {
this.y_axis = []; this.y_axis = [];
_.each( _.each(
records, records,
function(record) { function (record) {
var x = record.data[this.field_x_axis], var x = record.data[this.field_x_axis],
y = record.data[this.field_y_axis]; y = record.data[this.field_y_axis];
if (x.type === "record") { if (x.type === "record") {
@ -112,14 +112,14 @@ odoo.define("web_widget_x2many_2d_matrix.widget", function(require) {
this.columns = []; this.columns = [];
_.each( _.each(
this.x_axis, this.x_axis,
function(x) { function (x) {
this.columns.push(this._make_column(x)); this.columns.push(this._make_column(x));
}.bind(this) }.bind(this)
); );
this.rows = []; this.rows = [];
_.each( _.each(
this.y_axis, this.y_axis,
function(y) { function (y) {
this.rows.push(this._make_row(y)); this.rows.push(this._make_row(y));
}.bind(this) }.bind(this)
); );
@ -141,7 +141,7 @@ odoo.define("web_widget_x2many_2d_matrix.widget", function(require) {
* @param {String} x The string used as a column title * @param {String} x The string used as a column title
* @returns {Object} * @returns {Object}
*/ */
_make_column: function(x) { _make_column: function (x) {
return { return {
// Simulate node parsed on xml arch // Simulate node parsed on xml arch
tag: "field", tag: "field",
@ -158,7 +158,7 @@ odoo.define("web_widget_x2many_2d_matrix.widget", function(require) {
* @param {String} y The string used as a row title * @param {String} y The string used as a row title
* @returns {Object} * @returns {Object}
*/ */
_make_row: function(y) { _make_row: function (y) {
var self = this; var self = this;
// Use object so that we can attach more data if needed // Use object so that we can attach more data if needed
var row = { var row = {
@ -169,7 +169,7 @@ odoo.define("web_widget_x2many_2d_matrix.widget", function(require) {
}, },
data: [], data: [],
}; };
_.each(self.x_axis, function(x) { _.each(self.x_axis, function (x) {
row.data.push(self.by_y_axis[y][x]); row.data.push(self.by_y_axis[y][x]);
}); });
return row; return row;
@ -178,7 +178,7 @@ odoo.define("web_widget_x2many_2d_matrix.widget", function(require) {
/** /**
* Determine if a field represented by field_def can be aggregated * Determine if a field represented by field_def can be aggregated
*/ */
is_aggregatable: function(field_def) { is_aggregatable: function (field_def) {
return field_def.type in {float: 1, monetary: 1, integer: 1}; return field_def.type in {float: 1, monetary: 1, integer: 1};
}, },
@ -188,7 +188,7 @@ odoo.define("web_widget_x2many_2d_matrix.widget", function(require) {
* @param {String} val: the string to be parsed. * @param {String} val: the string to be parsed.
* @returns {Boolean} The parsed boolean. * @returns {Boolean} The parsed boolean.
*/ */
parse_boolean: function(val) { parse_boolean: function (val) {
if (val.toLowerCase() === "true" || val === "1") { if (val.toLowerCase() === "true" || val === "1") {
return true; return true;
} }
@ -201,7 +201,7 @@ odoo.define("web_widget_x2many_2d_matrix.widget", function(require) {
* @returns {Deferred} * @returns {Deferred}
* A deferred object to be completed when it finished rendering. * A deferred object to be completed when it finished rendering.
*/ */
_render: function() { _render: function () {
if (!this.view) { if (!this.view) {
return this._super(); return this._super();
} }
@ -230,7 +230,7 @@ odoo.define("web_widget_x2many_2d_matrix.widget", function(require) {
* *
* @override * @override
*/ */
activate: function(options) { activate: function (options) {
// Won't work fine without https://github.com/odoo/odoo/pull/26490 // Won't work fine without https://github.com/odoo/odoo/pull/26490
// TODO Use _.propertyOf in underscore 1.9+ // TODO Use _.propertyOf in underscore 1.9+
try { try {
@ -248,7 +248,7 @@ odoo.define("web_widget_x2many_2d_matrix.widget", function(require) {
* *
* @override * @override
*/ */
getFocusableElement: function() { getFocusableElement: function () {
return this.$(".o_input:" + (this._backwards ? "last" : "first")); return this.$(".o_input:" + (this._backwards ? "last" : "first"));
}, },
}); });