From 0b44b484f68bcf9ff770b452707f3420f715e8d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A0=20Gil=20Sorribes?= Date: Fri, 14 Feb 2020 10:07:29 +0100 Subject: [PATCH] [13.0][MIG] web_widget_x2many_2d_matrix --- web_widget_x2many_2d_matrix/README.rst | 11 +++++----- web_widget_x2many_2d_matrix/__manifest__.py | 6 +++--- .../i18n/web_widget_x2many_2d_matrix.pot | 15 +++++++------ .../readme/CONTRIBUTORS.rst | 1 + .../static/description/index.html | 7 ++++--- .../static/src/js/2d_matrix_renderer.js | 21 ++++++++++++++++--- .../static/src/js/widget_x2many_2d_matrix.js | 1 + 7 files changed, 40 insertions(+), 22 deletions(-) diff --git a/web_widget_x2many_2d_matrix/README.rst b/web_widget_x2many_2d_matrix/README.rst index 0cedb55ca..2f503f3d1 100644 --- a/web_widget_x2many_2d_matrix/README.rst +++ b/web_widget_x2many_2d_matrix/README.rst @@ -14,13 +14,13 @@ :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/12.0/web_widget_x2many_2d_matrix + :target: https://github.com/OCA/web/tree/13.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-12-0/web-12-0-web_widget_x2many_2d_matrix + :target: https://translation.odoo-community.org/projects/web-13-0/web-13-0-web_widget_x2many_2d_matrix :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/162/12.0 + :target: https://runbot.odoo-community.org/runbot/162/13.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -191,7 +191,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 smashing it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -217,6 +217,7 @@ Contributors * Jairo Llopis * Dennis Sluijk * Alexey Pelykh +* Adrià Gil Sorribes Maintainers ~~~~~~~~~~~ @@ -231,6 +232,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. -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/__manifest__.py b/web_widget_x2many_2d_matrix/__manifest__.py index a898754d7..ee8f1da58 100644 --- a/web_widget_x2many_2d_matrix/__manifest__.py +++ b/web_widget_x2many_2d_matrix/__manifest__.py @@ -4,7 +4,7 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { "name": "2D matrix for x2many fields", - "version": "12.0.2.2.0", + "version": "13.0.1.1.0", "author": ( "Therp BV, " "Tecnativa, " @@ -16,7 +16,7 @@ "license": "AGPL-3", "category": "Hidden/Dependency", "summary": "Show list fields as a matrix", - "depends": ["web",], - "data": ["views/assets.xml",], + "depends": ["web"], + "data": ["views/assets.xml"], "installable": True, } diff --git a/web_widget_x2many_2d_matrix/i18n/web_widget_x2many_2d_matrix.pot b/web_widget_x2many_2d_matrix/i18n/web_widget_x2many_2d_matrix.pot index 0171482c8..0aad260fd 100644 --- a/web_widget_x2many_2d_matrix/i18n/web_widget_x2many_2d_matrix.pot +++ b/web_widget_x2many_2d_matrix/i18n/web_widget_x2many_2d_matrix.pot @@ -1,12 +1,12 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * web_widget_x2many_2d_matrix +# * web_widget_x2many_2d_matrix # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 12.0\n" +"Project-Id-Version: Odoo Server 13.0\n" "Report-Msgid-Bugs-To: \n" -"Last-Translator: <>\n" +"Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -15,23 +15,22 @@ msgstr "" #. module: web_widget_x2many_2d_matrix #. openerp-web -#: code:addons/web_widget_x2many_2d_matrix/static/src/js/2d_matrix_renderer.js:65 +#: code:addons/web_widget_x2many_2d_matrix/static/src/js/2d_matrix_renderer.js:0 #, python-format msgid "Sorry no matrix data to display." msgstr "" #. module: web_widget_x2many_2d_matrix #. openerp-web -#: code:addons/web_widget_x2many_2d_matrix/static/src/js/2d_matrix_renderer.js:400 -#: code:addons/web_widget_x2many_2d_matrix/static/src/js/2d_matrix_renderer.js:475 +#: code:addons/web_widget_x2many_2d_matrix/static/src/js/2d_matrix_renderer.js:0 +#: code:addons/web_widget_x2many_2d_matrix/static/src/js/2d_matrix_renderer.js:0 #, python-format msgid "Sum" msgstr "" #. module: web_widget_x2many_2d_matrix #. openerp-web -#: code:addons/web_widget_x2many_2d_matrix/static/src/js/2d_matrix_renderer.js:394 +#: code:addons/web_widget_x2many_2d_matrix/static/src/js/2d_matrix_renderer.js:0 #, python-format msgid "Sum Total" msgstr "" - diff --git a/web_widget_x2many_2d_matrix/readme/CONTRIBUTORS.rst b/web_widget_x2many_2d_matrix/readme/CONTRIBUTORS.rst index f30eb3eb1..88111d553 100644 --- a/web_widget_x2many_2d_matrix/readme/CONTRIBUTORS.rst +++ b/web_widget_x2many_2d_matrix/readme/CONTRIBUTORS.rst @@ -6,3 +6,4 @@ * Jairo Llopis * Dennis Sluijk * Alexey Pelykh +* Adrià Gil Sorribes diff --git a/web_widget_x2many_2d_matrix/static/description/index.html b/web_widget_x2many_2d_matrix/static/description/index.html index beac91d17..0c192ddd0 100644 --- a/web_widget_x2many_2d_matrix/static/description/index.html +++ b/web_widget_x2many_2d_matrix/static/description/index.html @@ -367,7 +367,7 @@ ul.auto-toc { !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: AGPL-3 OCA/web Translate me on Weblate Try me on Runbot

+

Beta License: AGPL-3 OCA/web Translate me on Weblate Try me on Runbot

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

@@ -551,7 +551,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 smashing it by providing a detailed and welcomed -feedback.

+feedback.

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

@@ -576,6 +576,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
  • Jairo Llopis <jairo.llopis@tecnativa.com>
  • Dennis Sluijk <d.sluijk@onestein.nl>
  • Alexey Pelykh <alexey.pelykh@brainbeanapps.com>
  • +
  • Adrià Gil Sorribes <adria.gil@forgeflow.com>
  • @@ -585,7 +586,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome

    OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

    -

    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/js/2d_matrix_renderer.js b/web_widget_x2many_2d_matrix/static/src/js/2d_matrix_renderer.js index 7b7fb0a8e..e0bf72f28 100644 --- a/web_widget_x2many_2d_matrix/static/src/js/2d_matrix_renderer.js +++ b/web_widget_x2many_2d_matrix/static/src/js/2d_matrix_renderer.js @@ -9,6 +9,7 @@ odoo.define("web_widget_x2many_2d_matrix.X2Many2dMatrixRenderer", function(requi var config = require("web.config"); var core = require("web.core"); var field_utils = require("web.field_utils"); + var utils = require("web.utils"); var _t = core._t; var FIELD_CLASSES = { @@ -73,10 +74,16 @@ odoo.define("web_widget_x2many_2d_matrix.X2Many2dMatrixRenderer", function(requi this._computeColumnAggregates(); this._computeRowAggregates(); + // We need to initialize the deferred list object for inherited functions that use this.defs even if it + // is empty at the moment. + var defs = []; + this.defs = defs; + $table.append(this._renderHeader()).append(this._renderBody()); if (self.matrix_data.show_column_totals) { $table.append(this._renderFooter()); } + delete this.defs; return this._super(); }, @@ -192,8 +199,7 @@ odoo.define("web_widget_x2many_2d_matrix.X2Many2dMatrixRenderer", function(requi var $tr = $("", {class: "o_data_row"}), _data = _.without(row.data, undefined); $tr = $tr.append(this._renderLabelCell(_data[0])); - var $cells = _.map( - this.columns, + var $cells = this.columns.map( function(column, index) { var record = row.data[index]; // Make the widget use our field value for each cell @@ -302,7 +308,6 @@ odoo.define("web_widget_x2many_2d_matrix.X2Many2dMatrixRenderer", function(requi return $td.append(this._renderWidget(record, node)); } var $el = this._renderFieldWidget(node, record, _.pick(options, "mode")); - this._handleAttributes($el, node); return $td.append($el); }, @@ -414,6 +419,16 @@ odoo.define("web_widget_x2many_2d_matrix.X2Many2dMatrixRenderer", function(requi ); }, + _getRecord: function(recordId) { + var record = null; + utils.traverse_records(this.state, function(r) { + if (r.id === recordId) { + record = r; + } + }); + return record; + }, + /** * @override */ diff --git a/web_widget_x2many_2d_matrix/static/src/js/widget_x2many_2d_matrix.js b/web_widget_x2many_2d_matrix/static/src/js/widget_x2many_2d_matrix.js index f856de14a..6c8ff957f 100644 --- a/web_widget_x2many_2d_matrix/static/src/js/widget_x2many_2d_matrix.js +++ b/web_widget_x2many_2d_matrix/static/src/js/widget_x2many_2d_matrix.js @@ -132,6 +132,7 @@ odoo.define("web_widget_x2many_2d_matrix.widget", function(require) { show_row_totals: this.show_row_totals, show_column_totals: this.show_column_totals, }; + console.log(this.matrix_data); }, /**