Vincent Hatakeyama
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with
20 additions and
4 deletions
-
web_widget_x2many_2d_matrix/README.rst
-
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
-
web_widget_x2many_2d_matrix_example/__init__.py
-
web_widget_x2many_2d_matrix_example/models/__init__.py
-
web_widget_x2many_2d_matrix_example/wizard/__init__.py
|
|
@ -70,6 +70,12 @@ show_row_totals |
|
|
|
show_column_totals |
|
|
|
If field_value is a numeric field, it indicates if you want to calculate |
|
|
|
column totals. True by default |
|
|
|
options: header_cell_max_char |
|
|
|
Will cut header cell text if the length is bigger that the indicated number. |
|
|
|
Default is no maximum. |
|
|
|
options: label_cell_max_char |
|
|
|
Will cut label cell text if the length is bigger that the indicated number. |
|
|
|
Default is no maximum. |
|
|
|
|
|
|
|
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas |
|
|
|
:alt: Try me on Runbot |
|
|
|
|
|
@ -133,6 +133,9 @@ odoo.define('web_widget_x2many_2d_matrix.X2Many2dMatrixRenderer', function (requ |
|
|
|
if (!field) { |
|
|
|
return $th; |
|
|
|
} |
|
|
|
if (this.matrix_data.header_cell_max_char > 0 && node.attrs.string.length > this.matrix_data.header_cell_max_char) { |
|
|
|
node.attrs.string = node.attrs.string.substring(0, this.matrix_data.header_cell_max_char-1) + '…'; |
|
|
|
} |
|
|
|
var description = null; |
|
|
|
if (node.attrs.widget) { |
|
|
|
description = this.state.fieldsInfo.list[name] |
|
|
@ -215,6 +218,9 @@ odoo.define('web_widget_x2many_2d_matrix.X2Many2dMatrixRenderer', function (requ |
|
|
|
value = value.data.display_name; |
|
|
|
} |
|
|
|
// Get 1st column filled w/ Y label
|
|
|
|
if (this.matrix_data.label_cell_max_char > 0 && value.length > this.matrix_data.label_cell_max_char) { |
|
|
|
value = value.substring(0, this.matrix_data.label_cell_max_char-1) + '…'; |
|
|
|
} |
|
|
|
$td.text(value); |
|
|
|
return $td; |
|
|
|
}, |
|
|
|
|
|
@ -63,6 +63,8 @@ odoo.define('web_widget_x2many_2d_matrix.widget', function (require) { |
|
|
|
this.parse_boolean(node.show_row_totals || '1'); |
|
|
|
this.show_column_totals = |
|
|
|
this.parse_boolean(node.show_column_totals || '1'); |
|
|
|
this.label_cell_max_char = this.nodeOptions.label_cell_max_char || -1; |
|
|
|
this.header_max_char = this.nodeOptions.header_max_char || -1; |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
@ -109,6 +111,8 @@ odoo.define('web_widget_x2many_2d_matrix.widget', function (require) { |
|
|
|
'rows': this.rows, |
|
|
|
'show_row_totals': this.show_row_totals, |
|
|
|
'show_column_totals': this.show_column_totals, |
|
|
|
'label_cell_max_char': this.label_cell_max_char, |
|
|
|
'header_cell_max_char': this.header_cell_max_char, |
|
|
|
}; |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
@ -1,2 +1,2 @@ |
|
|
|
from . import models |
|
|
|
from . import wizard |
|
|
|
from . import models # noqa: F401 |
|
|
|
from . import wizard # noqa: F401 |
|
|
@ -1 +1 @@ |
|
|
|
from . import x2m_demo |
|
|
|
from . import x2m_demo # noqa: F401 |
|
|
@ -1 +1 @@ |
|
|
|
from . import demo_wizard |
|
|
|
from . import demo_wizard # noqa: F401 |