From 9d17fbd853fc7628e564b05928f2490a178fff8f Mon Sep 17 00:00:00 2001 From: SodexisTeam Date: Thu, 29 Feb 2024 17:11:38 +0530 Subject: [PATCH] [IMP] web_widget_x2many_2d_matrix: pre-commit auto fixes --- web_widget_x2many_2d_matrix/README.rst | 251 +++++++++--------- web_widget_x2many_2d_matrix/pyproject.toml | 3 + .../readme/CONTRIBUTORS.md | 11 + .../readme/CONTRIBUTORS.rst | 13 - .../readme/DESCRIPTION.md | 19 ++ .../readme/DESCRIPTION.rst | 23 -- web_widget_x2many_2d_matrix/readme/HISTORY.md | 9 + .../readme/HISTORY.rst | 11 - web_widget_x2many_2d_matrix/readme/ROADMAP.md | 12 + .../readme/ROADMAP.rst | 16 -- web_widget_x2many_2d_matrix/readme/USAGE.md | 91 +++++++ web_widget_x2many_2d_matrix/readme/USAGE.rst | 88 ------ .../static/description/index.html | 83 +++--- .../x2many_2d_matrix_field.esm.js | 6 +- .../x2many_2d_matrix_renderer.esm.js | 2 +- .../views/fields/boolean/boolean_field.esm.js | 2 +- 16 files changed, 313 insertions(+), 327 deletions(-) create mode 100644 web_widget_x2many_2d_matrix/pyproject.toml create mode 100644 web_widget_x2many_2d_matrix/readme/CONTRIBUTORS.md delete mode 100644 web_widget_x2many_2d_matrix/readme/CONTRIBUTORS.rst create mode 100644 web_widget_x2many_2d_matrix/readme/DESCRIPTION.md delete mode 100644 web_widget_x2many_2d_matrix/readme/DESCRIPTION.rst create mode 100644 web_widget_x2many_2d_matrix/readme/HISTORY.md delete mode 100644 web_widget_x2many_2d_matrix/readme/HISTORY.rst create mode 100644 web_widget_x2many_2d_matrix/readme/ROADMAP.md delete mode 100644 web_widget_x2many_2d_matrix/readme/ROADMAP.rst create mode 100644 web_widget_x2many_2d_matrix/readme/USAGE.md delete mode 100644 web_widget_x2many_2d_matrix/readme/USAGE.rst diff --git a/web_widget_x2many_2d_matrix/README.rst b/web_widget_x2many_2d_matrix/README.rst index 311d1fb8f..12ab573a8 100644 --- a/web_widget_x2many_2d_matrix/README.rst +++ b/web_widget_x2many_2d_matrix/README.rst @@ -17,40 +17,40 @@ :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github - :target: https://github.com/OCA/web/tree/16.0/web_widget_x2many_2d_matrix + :target: https://github.com/OCA/web/tree/17.0/web_widget_x2many_2d_matrix :alt: OCA/web .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/web-16-0/web-16-0-web_widget_x2many_2d_matrix + :target: https://translation.odoo-community.org/projects/web-17-0/web-17-0-web_widget_x2many_2d_matrix :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png - :target: https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=16.0 + :target: https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=17.0 :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| -This module allows to show an x2many field with 3-tuples -($x_value, $y_value, $value) in a table +This module allows to show an x2many field with 3-tuples ($x_value, +$y_value, $value) in a table -+-----------+-------------+-------------+ -| | $x_value1 | $x_value2 | -+===========+=============+=============+ -| $y_value1 | $value(1/1) | $value(2/1) | -+-----------+-------------+-------------+ -| $y_value2 | $value(1/2) | $value(2/2) | -+-----------+-------------+-------------+ +========= =========== =========== +\ $x_value1 $x_value2 +========= =========== =========== +$y_value1 $value(1/1) $value(2/1) +$y_value2 $value(1/2) $value(2/2) +========= =========== =========== -where `value(n/n)` is editable. +where value(n/n) is editable. -An example use case would be: Select some projects and some employees so that -a manager can easily fill in the planned_hours for one task per employee. The -result could look like this: +An example use case would be: Select some projects and some employees so +that a manager can easily fill in the planned_hours for one task per +employee. The result could look like this: -.. image:: https://raw.githubusercontent.com/OCA/web/12.0/web_widget_x2many_2d_matrix/static/description/screenshot.png - :alt: Screenshot +|Screenshot| -The beauty of this is that you have an arbitrary amount of columns with this -widget, trying to get this in standard x2many lists involves some quite ugly -hacks. +The beauty of this is that you have an arbitrary amount of columns with +this widget, trying to get this in standard x2many lists involves some +quite ugly hacks. + +.. |Screenshot| image:: https://raw.githubusercontent.com/OCA/web/12.0/web_widget_x2many_2d_matrix/static/description/screenshot.png **Table of contents** @@ -60,129 +60,126 @@ hacks. Usage ===== -Use this widget by saying:: +Use this widget by saying: - +:: -This assumes that my_field refers to a model with the fields `x`, `y` and -`value`. If your fields are named differently, pass the correct names as + + +This assumes that my_field refers to a model with the fields x, y and +value. If your fields are named differently, pass the correct names as attributes: -.. code-block:: xml +.. code:: xml - - - - - - - - + + + + + + + + You can pass the following parameters: -field_x_axis - The field that indicates the x value of a point -field_y_axis - The field that indicates the y value of a point -field_value - Show this field as value -show_row_totals - If field_value is a numeric field, it indicates if you want to calculate - row totals. True by default -show_column_totals - If field_value is a numeric field, it indicates if you want to calculate - column totals. True by default +field_x_axis The field that indicates the x value of a point + +field_y_axis The field that indicates the y value of a point + +field_value Show this field as value + +show_row_totals If field_value is a numeric field, it indicates if you +want to calculate row totals. True by default + +show_column_totals If field_value is a numeric field, it indicates if +you want to calculate column totals. True by default Example -~~~~~~~ +------- -You need a data structure already filled with values. Let's assume we want to -use this widget in a wizard that lets the user fill in planned hours for one -task per project per user. In this case, we can use ``project.task`` as our -data model and point to it from our wizard. The crucial part is that we fill -the field in the default function: +You need a data structure already filled with values. Let's assume we +want to use this widget in a wizard that lets the user fill in planned +hours for one task per project per user. In this case, we can use +``project.task`` as our data model and point to it from our wizard. The +crucial part is that we fill the field in the default function: -.. code-block:: python +.. code:: python - from odoo import fields, models + from odoo import fields, models - class MyWizard(models.TransientModel): - _name = 'my.wizard' + class MyWizard(models.TransientModel): + _name = 'my.wizard' - def _default_task_ids(self): - # your list of project should come from the context, some selection - # in a previous wizard or wherever else - projects = self.env['project.project'].browse([1, 2, 3]) - # same with users - users = self.env['res.users'].browse([1, 2, 3]) - return [ - (0, 0, { - 'name': 'Sample task name', - 'project_id': p.id, - 'user_id': u.id, - 'planned_hours': 0, - 'message_needaction': False, - 'date_deadline': fields.Date.today(), - }) - # if the project doesn't have a task for the user, - # create a new one - if not p.task_ids.filtered(lambda x: x.user_id == u) else - # otherwise, return the task - (4, p.task_ids.filtered(lambda x: x.user_id == u)[0].id) - for p in projects - for u in users - ] + def _default_task_ids(self): + # your list of project should come from the context, some selection + # in a previous wizard or wherever else + projects = self.env['project.project'].browse([1, 2, 3]) + # same with users + users = self.env['res.users'].browse([1, 2, 3]) + return [ + (0, 0, { + 'name': 'Sample task name', + 'project_id': p.id, + 'user_id': u.id, + 'planned_hours': 0, + 'message_needaction': False, + 'date_deadline': fields.Date.today(), + }) + # if the project doesn't have a task for the user, + # create a new one + if not p.task_ids.filtered(lambda x: x.user_id == u) else + # otherwise, return the task + (4, p.task_ids.filtered(lambda x: x.user_id == u)[0].id) + for p in projects + for u in users + ] - task_ids = fields.Many2many('project.task', default=_default_task_ids) + task_ids = fields.Many2many('project.task', default=_default_task_ids) Now in our wizard, we can use: -.. code-block:: xml +.. code:: xml - - - - - - - - + + + + + + + + Known issues / Roadmap ====================== -* Support extra attributes on each field cell via `field_extra_attrs` param. - We could set a cell as not editable, required or readonly for instance. - The `readonly` case will also give the ability - to click on m2o to open related records. - -* Support limit total records in the matrix. Ref: https://github.com/OCA/web/issues/901 - -* Support cell traversal through keyboard arrows. - -* Entering the widget from behind by pressing ``Shift+TAB`` in your keyboard - will enter into the 1st cell until https://github.com/odoo/odoo/pull/26490 - is merged. - -* Support extra invisible fields inside each cell. - -* Support kanban mode. Current behaviour forces list mode. +- Support extra attributes on each field cell via field_extra_attrs + param. We could set a cell as not editable, required or readonly for + instance. The readonly case will also give the ability to click on + m2o to open related records. +- Support limit total records in the matrix. Ref: + https://github.com/OCA/web/issues/901 +- Support cell traversal through keyboard arrows. +- Entering the widget from behind by pressing ``Shift+TAB`` in your + keyboard will enter into the 1st cell until + https://github.com/odoo/odoo/pull/26490 is merged. +- Support extra invisible fields inside each cell. +- Support kanban mode. Current behaviour forces list mode. Changelog ========= 12.0.1.0.1 (2018-12-07) -~~~~~~~~~~~~~~~~~~~~~~~ +----------------------- -* [FIX] Cells are unable to render property. - (`#1126 `_) +- [FIX] Cells are unable to render property. + (`#1126 `__) 12.0.1.0.0 (2018-11-20) -~~~~~~~~~~~~~~~~~~~~~~~ +----------------------- -* [12.0][MIG] web_widget_x2many_2d_matrix - (`#1101 `_) +- [12.0][MIG] web_widget_x2many_2d_matrix + (`#1101 `__) Bug Tracker =========== @@ -190,7 +187,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -198,7 +195,7 @@ Credits ======= Authors -~~~~~~~ +------- * Therp BV * Tecnativa @@ -207,24 +204,24 @@ Authors * Onestein Contributors -~~~~~~~~~~~~ +------------ -* Holger Brunn -* Pedro M. Baeza -* Artem Kostyuk -* Simone Orsi -* Timon Tschanz -* Jairo Llopis -* Dennis Sluijk -* `CorporateHub `__ +- Holger Brunn +- Pedro M. Baeza +- Artem Kostyuk +- Simone Orsi +- Timon Tschanz +- Jairo Llopis +- Dennis Sluijk +- `CorporateHub `__ - * Alexey Pelykh + - Alexey Pelykh -* Adrià Gil Sorribes -* Christopher Ormaza +- Adrià Gil Sorribes +- Christopher Ormaza Maintainers -~~~~~~~~~~~ +----------- This module is maintained by the OCA. @@ -244,6 +241,6 @@ Current `maintainer `__: |maintainer-ChrisOForgeFlow| -This module is part of the `OCA/web `_ project on GitHub. +This module is part of the `OCA/web `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/web_widget_x2many_2d_matrix/pyproject.toml b/web_widget_x2many_2d_matrix/pyproject.toml new file mode 100644 index 000000000..4231d0ccc --- /dev/null +++ b/web_widget_x2many_2d_matrix/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/web_widget_x2many_2d_matrix/readme/CONTRIBUTORS.md b/web_widget_x2many_2d_matrix/readme/CONTRIBUTORS.md new file mode 100644 index 000000000..55fb01564 --- /dev/null +++ b/web_widget_x2many_2d_matrix/readme/CONTRIBUTORS.md @@ -0,0 +1,11 @@ +- Holger Brunn \<\> +- Pedro M. Baeza \<\> +- Artem Kostyuk \<\> +- Simone Orsi \<\> +- Timon Tschanz \<\> +- Jairo Llopis \<\> +- Dennis Sluijk \<\> +- [CorporateHub](https://corporatehub.eu/) + - Alexey Pelykh \<\> +- Adrià Gil Sorribes \<\> +- Christopher Ormaza \<\> diff --git a/web_widget_x2many_2d_matrix/readme/CONTRIBUTORS.rst b/web_widget_x2many_2d_matrix/readme/CONTRIBUTORS.rst deleted file mode 100644 index 945e85d5c..000000000 --- a/web_widget_x2many_2d_matrix/readme/CONTRIBUTORS.rst +++ /dev/null @@ -1,13 +0,0 @@ -* Holger Brunn -* Pedro M. Baeza -* Artem Kostyuk -* Simone Orsi -* Timon Tschanz -* Jairo Llopis -* Dennis Sluijk -* `CorporateHub `__ - - * Alexey Pelykh - -* Adrià Gil Sorribes -* Christopher Ormaza diff --git a/web_widget_x2many_2d_matrix/readme/DESCRIPTION.md b/web_widget_x2many_2d_matrix/readme/DESCRIPTION.md new file mode 100644 index 000000000..bad2cb471 --- /dev/null +++ b/web_widget_x2many_2d_matrix/readme/DESCRIPTION.md @@ -0,0 +1,19 @@ +This module allows to show an x2many field with 3-tuples (\$x_value, +\$y_value, \$value) in a table + +| | \$x_value1 | \$x_value2 | +|------------|--------------|--------------| +| \$y_value1 | \$value(1/1) | \$value(2/1) | +| \$y_value2 | \$value(1/2) | \$value(2/2) | + +where value(n/n) is editable. + +An example use case would be: Select some projects and some employees so +that a manager can easily fill in the planned_hours for one task per +employee. The result could look like this: + +![Screenshot](https://raw.githubusercontent.com/OCA/web/12.0/web_widget_x2many_2d_matrix/static/description/screenshot.png) + +The beauty of this is that you have an arbitrary amount of columns with +this widget, trying to get this in standard x2many lists involves some +quite ugly hacks. diff --git a/web_widget_x2many_2d_matrix/readme/DESCRIPTION.rst b/web_widget_x2many_2d_matrix/readme/DESCRIPTION.rst deleted file mode 100644 index d3f10cae8..000000000 --- a/web_widget_x2many_2d_matrix/readme/DESCRIPTION.rst +++ /dev/null @@ -1,23 +0,0 @@ -This module allows to show an x2many field with 3-tuples -($x_value, $y_value, $value) in a table - -+-----------+-------------+-------------+ -| | $x_value1 | $x_value2 | -+===========+=============+=============+ -| $y_value1 | $value(1/1) | $value(2/1) | -+-----------+-------------+-------------+ -| $y_value2 | $value(1/2) | $value(2/2) | -+-----------+-------------+-------------+ - -where `value(n/n)` is editable. - -An example use case would be: Select some projects and some employees so that -a manager can easily fill in the planned_hours for one task per employee. The -result could look like this: - -.. image:: https://raw.githubusercontent.com/OCA/web/12.0/web_widget_x2many_2d_matrix/static/description/screenshot.png - :alt: Screenshot - -The beauty of this is that you have an arbitrary amount of columns with this -widget, trying to get this in standard x2many lists involves some quite ugly -hacks. diff --git a/web_widget_x2many_2d_matrix/readme/HISTORY.md b/web_widget_x2many_2d_matrix/readme/HISTORY.md new file mode 100644 index 000000000..8edfd5190 --- /dev/null +++ b/web_widget_x2many_2d_matrix/readme/HISTORY.md @@ -0,0 +1,9 @@ +## 12.0.1.0.1 (2018-12-07) + +- \[FIX\] Cells are unable to render property. + ([\#1126](https://github.com/OCA/web/issues/1126)) + +## 12.0.1.0.0 (2018-11-20) + +- \[12.0\]\[MIG\] web_widget_x2many_2d_matrix + ([\#1101](https://github.com/OCA/web/issues/1101)) diff --git a/web_widget_x2many_2d_matrix/readme/HISTORY.rst b/web_widget_x2many_2d_matrix/readme/HISTORY.rst deleted file mode 100644 index 8bad8c46c..000000000 --- a/web_widget_x2many_2d_matrix/readme/HISTORY.rst +++ /dev/null @@ -1,11 +0,0 @@ -12.0.1.0.1 (2018-12-07) -~~~~~~~~~~~~~~~~~~~~~~~ - -* [FIX] Cells are unable to render property. - (`#1126 `_) - -12.0.1.0.0 (2018-11-20) -~~~~~~~~~~~~~~~~~~~~~~~ - -* [12.0][MIG] web_widget_x2many_2d_matrix - (`#1101 `_) diff --git a/web_widget_x2many_2d_matrix/readme/ROADMAP.md b/web_widget_x2many_2d_matrix/readme/ROADMAP.md new file mode 100644 index 000000000..234aa7cd5 --- /dev/null +++ b/web_widget_x2many_2d_matrix/readme/ROADMAP.md @@ -0,0 +1,12 @@ +- Support extra attributes on each field cell via field_extra_attrs + param. We could set a cell as not editable, required or readonly for + instance. The readonly case will also give the ability to click on m2o + to open related records. +- Support limit total records in the matrix. Ref: + +- Support cell traversal through keyboard arrows. +- Entering the widget from behind by pressing `Shift+TAB` in your + keyboard will enter into the 1st cell until + is merged. +- Support extra invisible fields inside each cell. +- Support kanban mode. Current behaviour forces list mode. diff --git a/web_widget_x2many_2d_matrix/readme/ROADMAP.rst b/web_widget_x2many_2d_matrix/readme/ROADMAP.rst deleted file mode 100644 index 1dc1a84da..000000000 --- a/web_widget_x2many_2d_matrix/readme/ROADMAP.rst +++ /dev/null @@ -1,16 +0,0 @@ -* Support extra attributes on each field cell via `field_extra_attrs` param. - We could set a cell as not editable, required or readonly for instance. - The `readonly` case will also give the ability - to click on m2o to open related records. - -* Support limit total records in the matrix. Ref: https://github.com/OCA/web/issues/901 - -* Support cell traversal through keyboard arrows. - -* Entering the widget from behind by pressing ``Shift+TAB`` in your keyboard - will enter into the 1st cell until https://github.com/odoo/odoo/pull/26490 - is merged. - -* Support extra invisible fields inside each cell. - -* Support kanban mode. Current behaviour forces list mode. diff --git a/web_widget_x2many_2d_matrix/readme/USAGE.md b/web_widget_x2many_2d_matrix/readme/USAGE.md new file mode 100644 index 000000000..d85bd6fed --- /dev/null +++ b/web_widget_x2many_2d_matrix/readme/USAGE.md @@ -0,0 +1,91 @@ +Use this widget by saying: + + + +This assumes that my_field refers to a model with the fields x, y and +value. If your fields are named differently, pass the correct names as +attributes: + +``` xml + + + + + + + + +``` + +You can pass the following parameters: + +field_x_axis +The field that indicates the x value of a point + +field_y_axis +The field that indicates the y value of a point + +field_value +Show this field as value + +show_row_totals +If field_value is a numeric field, it indicates if you want to calculate +row totals. True by default + +show_column_totals +If field_value is a numeric field, it indicates if you want to calculate +column totals. True by default + +## Example + +You need a data structure already filled with values. Let's assume we +want to use this widget in a wizard that lets the user fill in planned +hours for one task per project per user. In this case, we can use +`project.task` as our data model and point to it from our wizard. The +crucial part is that we fill the field in the default function: + +``` python +from odoo import fields, models + +class MyWizard(models.TransientModel): + _name = 'my.wizard' + + def _default_task_ids(self): + # your list of project should come from the context, some selection + # in a previous wizard or wherever else + projects = self.env['project.project'].browse([1, 2, 3]) + # same with users + users = self.env['res.users'].browse([1, 2, 3]) + return [ + (0, 0, { + 'name': 'Sample task name', + 'project_id': p.id, + 'user_id': u.id, + 'planned_hours': 0, + 'message_needaction': False, + 'date_deadline': fields.Date.today(), + }) + # if the project doesn't have a task for the user, + # create a new one + if not p.task_ids.filtered(lambda x: x.user_id == u) else + # otherwise, return the task + (4, p.task_ids.filtered(lambda x: x.user_id == u)[0].id) + for p in projects + for u in users + ] + + task_ids = fields.Many2many('project.task', default=_default_task_ids) +``` + +Now in our wizard, we can use: + +``` xml + + + + + + + + +``` diff --git a/web_widget_x2many_2d_matrix/readme/USAGE.rst b/web_widget_x2many_2d_matrix/readme/USAGE.rst deleted file mode 100644 index bab81c79b..000000000 --- a/web_widget_x2many_2d_matrix/readme/USAGE.rst +++ /dev/null @@ -1,88 +0,0 @@ -Use this widget by saying:: - - - -This assumes that my_field refers to a model with the fields `x`, `y` and -`value`. If your fields are named differently, pass the correct names as -attributes: - -.. code-block:: xml - - - - - - - - - - -You can pass the following parameters: - -field_x_axis - The field that indicates the x value of a point -field_y_axis - The field that indicates the y value of a point -field_value - Show this field as value -show_row_totals - If field_value is a numeric field, it indicates if you want to calculate - row totals. True by default -show_column_totals - If field_value is a numeric field, it indicates if you want to calculate - column totals. True by default - -Example -~~~~~~~ - -You need a data structure already filled with values. Let's assume we want to -use this widget in a wizard that lets the user fill in planned hours for one -task per project per user. In this case, we can use ``project.task`` as our -data model and point to it from our wizard. The crucial part is that we fill -the field in the default function: - -.. code-block:: python - - from odoo import fields, models - - class MyWizard(models.TransientModel): - _name = 'my.wizard' - - def _default_task_ids(self): - # your list of project should come from the context, some selection - # in a previous wizard or wherever else - projects = self.env['project.project'].browse([1, 2, 3]) - # same with users - users = self.env['res.users'].browse([1, 2, 3]) - return [ - (0, 0, { - 'name': 'Sample task name', - 'project_id': p.id, - 'user_id': u.id, - 'planned_hours': 0, - 'message_needaction': False, - 'date_deadline': fields.Date.today(), - }) - # if the project doesn't have a task for the user, - # create a new one - if not p.task_ids.filtered(lambda x: x.user_id == u) else - # otherwise, return the task - (4, p.task_ids.filtered(lambda x: x.user_id == u)[0].id) - for p in projects - for u in users - ] - - task_ids = fields.Many2many('project.task', default=_default_task_ids) - -Now in our wizard, we can use: - -.. code-block:: xml - - - - - - - - - diff --git a/web_widget_x2many_2d_matrix/static/description/index.html b/web_widget_x2many_2d_matrix/static/description/index.html index 763074aa4..cdba63012 100644 --- a/web_widget_x2many_2d_matrix/static/description/index.html +++ b/web_widget_x2many_2d_matrix/static/description/index.html @@ -1,3 +1,4 @@ + @@ -368,17 +369,17 @@ ul.auto-toc { !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! source digest: sha256:d7c8ad17385abb55574b0135c2b9bcf91cdccc82964a136b4c14754bd7975d43 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Production/Stable License: AGPL-3 OCA/web Translate me on Weblate Try me on Runboat

-

This module allows to show an x2many field with 3-tuples -($x_value, $y_value, $value) in a table

+

Production/Stable License: AGPL-3 OCA/web Translate me on Weblate Try me on Runboat

+

This module allows to show an x2many field with 3-tuples ($x_value, +$y_value, $value) in a table

-+ - + @@ -394,14 +395,14 @@ ul.auto-toc {
 
$x_value1 $x_value2
-

where value(n/n) is editable.

-

An example use case would be: Select some projects and some employees so that -a manager can easily fill in the planned_hours for one task per employee. The -result could look like this:

-Screenshot -

The beauty of this is that you have an arbitrary amount of columns with this -widget, trying to get this in standard x2many lists involves some quite ugly -hacks.

+

where value(n/n) is editable.

+

An example use case would be: Select some projects and some employees so +that a manager can easily fill in the planned_hours for one task per +employee. The result could look like this:

+

Screenshot

+

The beauty of this is that you have an arbitrary amount of columns with +this widget, trying to get this in standard x2many lists involves some +quite ugly hacks.

Table of contents

    @@ -430,8 +431,8 @@ hacks.

     <field name="my_field" widget="x2many_2d_matrix" />
     
    -

    This assumes that my_field refers to a model with the fields x, y and -value. If your fields are named differently, pass the correct names as +

    This assumes that my_field refers to a model with the fields x, y and +value. If your fields are named differently, pass the correct names as attributes:

     <field name="my_field" widget="x2many_2d_matrix" field_x_axis="my_field1" field_y_axis="my_field2" field_value="my_field3">
    @@ -444,27 +445,20 @@ attributes:

    </field>

    You can pass the following parameters:

    -
    -
    field_x_axis
    -
    The field that indicates the x value of a point
    -
    field_y_axis
    -
    The field that indicates the y value of a point
    -
    field_value
    -
    Show this field as value
    -
    show_row_totals
    -
    If field_value is a numeric field, it indicates if you want to calculate -row totals. True by default
    -
    show_column_totals
    -
    If field_value is a numeric field, it indicates if you want to calculate -column totals. True by default
    -
    +

    field_x_axis The field that indicates the x value of a point

    +

    field_y_axis The field that indicates the y value of a point

    +

    field_value Show this field as value

    +

    show_row_totals If field_value is a numeric field, it indicates if you +want to calculate row totals. True by default

    +

    show_column_totals If field_value is a numeric field, it indicates if +you want to calculate column totals. True by default

    Example

    -

    You need a data structure already filled with values. Let’s assume we want to -use this widget in a wizard that lets the user fill in planned hours for one -task per project per user. In this case, we can use project.task as our -data model and point to it from our wizard. The crucial part is that we fill -the field in the default function:

    +

    You need a data structure already filled with values. Let’s assume we +want to use this widget in a wizard that lets the user fill in planned +hours for one task per project per user. In this case, we can use +project.task as our data model and point to it from our wizard. The +crucial part is that we fill the field in the default function:

     from odoo import fields, models
     
    @@ -513,15 +507,16 @@ the field in the default function:

    Known issues / Roadmap

      -
    • Support extra attributes on each field cell via field_extra_attrs param. -We could set a cell as not editable, required or readonly for instance. -The readonly case will also give the ability -to click on m2o to open related records.
    • -
    • Support limit total records in the matrix. Ref: https://github.com/OCA/web/issues/901
    • +
    • Support extra attributes on each field cell via field_extra_attrs +param. We could set a cell as not editable, required or readonly for +instance. The readonly case will also give the ability to click on +m2o to open related records.
    • +
    • Support limit total records in the matrix. Ref: +https://github.com/OCA/web/issues/901
    • Support cell traversal through keyboard arrows.
    • -
    • Entering the widget from behind by pressing Shift+TAB in your keyboard -will enter into the 1st cell until https://github.com/odoo/odoo/pull/26490 -is merged.
    • +
    • Entering the widget from behind by pressing Shift+TAB in your +keyboard will enter into the 1st cell until +https://github.com/odoo/odoo/pull/26490 is merged.
    • Support extra invisible fields inside each cell.
    • Support kanban mode. Current behaviour forces list mode.
    @@ -548,7 +543,7 @@ is merged.

    Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed -feedback.

    +feedback.

    Do not contact contributors directly about support or help with technical issues.

    @@ -590,7 +585,7 @@ mission is to support the collaborative development of Odoo features and promote its widespread use.

    Current maintainer:

    ChrisOForgeFlow

    -

    This module is part of the OCA/web project on GitHub.

    +

    This module is part of the OCA/web project on GitHub.

    You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

    diff --git a/web_widget_x2many_2d_matrix/static/src/components/x2many_2d_matrix_field/x2many_2d_matrix_field.esm.js b/web_widget_x2many_2d_matrix/static/src/components/x2many_2d_matrix_field/x2many_2d_matrix_field.esm.js index a0a71442f..9bfa424a8 100644 --- a/web_widget_x2many_2d_matrix/static/src/components/x2many_2d_matrix_field/x2many_2d_matrix_field.esm.js +++ b/web_widget_x2many_2d_matrix/static/src/components/x2many_2d_matrix_field/x2many_2d_matrix_field.esm.js @@ -1,10 +1,10 @@ /** @odoo-module **/ import {Component} from "@odoo/owl"; -import {standardFieldProps} from "@web/views/fields/standard_field_props"; -import {registry} from "@web/core/registry"; -import {archParseBoolean} from "@web/views/utils"; import {X2Many2DMatrixRenderer} from "@web_widget_x2many_2d_matrix/components/x2many_2d_matrix_renderer/x2many_2d_matrix_renderer.esm"; +import {archParseBoolean} from "@web/views/utils"; +import {registry} from "@web/core/registry"; +import {standardFieldProps} from "@web/views/fields/standard_field_props"; export class X2Many2DMatrixField extends Component { setup() { diff --git a/web_widget_x2many_2d_matrix/static/src/components/x2many_2d_matrix_renderer/x2many_2d_matrix_renderer.esm.js b/web_widget_x2many_2d_matrix/static/src/components/x2many_2d_matrix_renderer/x2many_2d_matrix_renderer.esm.js index 867a1b065..95d7ad9c6 100644 --- a/web_widget_x2many_2d_matrix/static/src/components/x2many_2d_matrix_renderer/x2many_2d_matrix_renderer.esm.js +++ b/web_widget_x2many_2d_matrix/static/src/components/x2many_2d_matrix_renderer/x2many_2d_matrix_renderer.esm.js @@ -155,7 +155,7 @@ export class X2Many2DMatrixRenderer extends Component { ...props, ...propsFromAttrs, value: value, - update: (value) => this.update(x, y, value), + update: (val) => this.update(x, y, val), readonly: this.props.readonly, record: record, name: this.matrixFields.value, diff --git a/web_widget_x2many_2d_matrix/static/src/views/fields/boolean/boolean_field.esm.js b/web_widget_x2many_2d_matrix/static/src/views/fields/boolean/boolean_field.esm.js index ad07df7ae..d3efe8549 100644 --- a/web_widget_x2many_2d_matrix/static/src/views/fields/boolean/boolean_field.esm.js +++ b/web_widget_x2many_2d_matrix/static/src/views/fields/boolean/boolean_field.esm.js @@ -1,7 +1,7 @@ /** @odoo-module **/ -import {patch} from "@web/core/utils/patch"; import {BooleanField} from "@web/views/fields/boolean/boolean_field"; +import {patch} from "@web/core/utils/patch"; patch(BooleanField.prototype, "web_widget_x2many_2d_matrix", { get isReadonly() {