Vincent Hatakeyama
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with
23 additions and
3 deletions
-
web_widget_x2many_2d_matrix/README.rst
-
web_widget_x2many_2d_matrix/__manifest__.py
-
web_widget_x2many_2d_matrix/static/src/js/2d_matrix_renderer.js
-
web_widget_x2many_2d_matrix/static/src/js/widget_x2many_2d_matrix.js
|
|
@ -67,6 +67,9 @@ field_value |
|
|
|
show_row_totals |
|
|
|
If field_value is a numeric field, it indicates if you want to calculate |
|
|
|
row totals. True by default |
|
|
|
label_row_totals |
|
|
|
If show_row_totals is True, this will allow to set a column label for the |
|
|
|
totals column. Default to ''. |
|
|
|
show_column_totals |
|
|
|
If field_value is a numeric field, it indicates if you want to calculate |
|
|
|
column totals. True by default |
|
|
|
|
|
@ -4,7 +4,7 @@ |
|
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|
|
|
{ |
|
|
|
"name": "2D matrix for x2many fields", |
|
|
|
"version": "11.0.1.1.2", |
|
|
|
"version": "11.0.1.1.3", |
|
|
|
"author": "Therp BV, " |
|
|
|
"Tecnativa, " |
|
|
|
"Camptocamp, " |
|
|
|
|
|
@ -111,10 +111,25 @@ odoo.define('web_widget_x2many_2d_matrix.X2Many2dMatrixRenderer', function (requ |
|
|
|
this.columns, |
|
|
|
this._renderHeaderCell.bind(this) |
|
|
|
)); |
|
|
|
$tr.append(this._renderHeaderSpecial()); |
|
|
|
return $('<thead>').append($tr); |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
* Render the special headers of our matrix, like totals |
|
|
|
* |
|
|
|
* @private |
|
|
|
* @returns {jQueryElement} a list of elements |
|
|
|
*/ |
|
|
|
_renderHeaderSpecial: function () { |
|
|
|
var ths = []; |
|
|
|
if (this.matrix_data.show_row_totals) { |
|
|
|
$tr.append($('<th/>', {class: 'total'})); |
|
|
|
var $th = $('<th>', {class: 'total text-right'}); |
|
|
|
// label_row_totals contains either something or ''
|
|
|
|
$th.append(this.matrix_data.label_row_totals).append('</th>'); |
|
|
|
ths.push($th); |
|
|
|
} |
|
|
|
return $('<thead>').append($tr); |
|
|
|
return ths; |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
|
|
@ -61,6 +61,7 @@ odoo.define('web_widget_x2many_2d_matrix.widget', function (require) { |
|
|
|
node.field_editability || this.field_editability; |
|
|
|
this.show_row_totals = |
|
|
|
this.parse_boolean(node.show_row_totals || '1'); |
|
|
|
this.label_row_totals = node.label_row_totals || ''; |
|
|
|
this.show_column_totals = |
|
|
|
this.parse_boolean(node.show_column_totals || '1'); |
|
|
|
}, |
|
|
@ -108,6 +109,7 @@ odoo.define('web_widget_x2many_2d_matrix.widget', function (require) { |
|
|
|
'columns': this.columns, |
|
|
|
'rows': this.rows, |
|
|
|
'show_row_totals': this.show_row_totals, |
|
|
|
'label_row_totals': this.label_row_totals, |
|
|
|
'show_column_totals': this.show_column_totals, |
|
|
|
}; |
|
|
|
}, |
|
|
|