Browse Source

Merge 0c4d05497a into d736ee4460

pull/1298/merge
Vincent Hatakeyama 5 years ago
committed by GitHub
parent
commit
a1cf8811c6
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      web_widget_x2many_2d_matrix/README.rst
  2. 6
      web_widget_x2many_2d_matrix/static/src/js/2d_matrix_renderer.js
  3. 4
      web_widget_x2many_2d_matrix/static/src/js/widget_x2many_2d_matrix.js
  4. 4
      web_widget_x2many_2d_matrix_example/__init__.py
  5. 2
      web_widget_x2many_2d_matrix_example/models/__init__.py
  6. 2
      web_widget_x2many_2d_matrix_example/wizard/__init__.py

6
web_widget_x2many_2d_matrix/README.rst

@ -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

6
web_widget_x2many_2d_matrix/static/src/js/2d_matrix_renderer.js

@ -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;
},

4
web_widget_x2many_2d_matrix/static/src/js/widget_x2many_2d_matrix.js

@ -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,
};
},

4
web_widget_x2many_2d_matrix_example/__init__.py

@ -1,2 +1,2 @@
from . import models
from . import wizard
from . import models # noqa: F401
from . import wizard # noqa: F401

2
web_widget_x2many_2d_matrix_example/models/__init__.py

@ -1 +1 @@
from . import x2m_demo
from . import x2m_demo # noqa: F401

2
web_widget_x2many_2d_matrix_example/wizard/__init__.py

@ -1 +1 @@
from . import demo_wizard
from . import demo_wizard # noqa: F401
Loading…
Cancel
Save