Skip to content

Commit

Permalink
[FIX] web_widget_x2many_2d_matrix: fixes (OCA#712)
Browse files Browse the repository at this point in the history
* Patches to make module operational.
* Minor fix to Readonly Switch
* Fix to render to set change attribute.
* Totals recompute.

Fixes OCA#697
  • Loading branch information
Richard deMeester authored and SodexisTeam committed Feb 29, 2024
1 parent 19a7b2b commit 71c5a46
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 5 deletions.
2 changes: 1 addition & 1 deletion web_widget_x2many_2d_matrix/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

{
"name": "2D matrix for x2many fields",
"version": "10.0.1.0.0",
"version": "10.0.1.0.1",
"author": "Therp BV, "
"Tecnativa,"
"Odoo Community Association (OCA)",
Expand Down
27 changes: 27 additions & 0 deletions web_widget_x2many_2d_matrix/i18n/lt.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_widget_x2many_2d_matrix
#
# Translators:
# Viktoras Norkus <viktoras@bmx.lt>, 2018
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-01-25 01:58+0000\n"
"PO-Revision-Date: 2018-01-25 01:58+0000\n"
"Last-Translator: Viktoras Norkus <viktoras@bmx.lt>, 2018\n"
"Language-Team: Lithuanian (https://www.transifex.com/oca/teams/23907/lt/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: lt\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2);\n"

#. module: web_widget_x2many_2d_matrix
#. openerp-web
#: code:addons/web_widget_x2many_2d_matrix/static/src/xml/web_widget_x2many_2d_matrix.xml:11
#: code:addons/web_widget_x2many_2d_matrix/static/src/xml/web_widget_x2many_2d_matrix.xml:28
#, python-format
msgid "Total"
msgstr "Suma"
27 changes: 27 additions & 0 deletions web_widget_x2many_2d_matrix/i18n/nl_NL.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_widget_x2many_2d_matrix
#
# Translators:
# Peter Hageman <hageman.p@gmail.com>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-01-03 03:50+0000\n"
"PO-Revision-Date: 2018-01-03 03:50+0000\n"
"Last-Translator: Peter Hageman <hageman.p@gmail.com>, 2017\n"
"Language-Team: Dutch (Netherlands) (https://www.transifex.com/oca/teams/23907/nl_NL/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: nl_NL\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#. module: web_widget_x2many_2d_matrix
#. openerp-web
#: code:addons/web_widget_x2many_2d_matrix/static/src/xml/web_widget_x2many_2d_matrix.xml:11
#: code:addons/web_widget_x2many_2d_matrix/static/src/xml/web_widget_x2many_2d_matrix.xml:28
#, python-format
msgid "Total"
msgstr "Totaal"
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ odoo.define('web_widget_x2many_2d_matrix.widget', function (require) {
})
.then(function()
{
return self.dataset.read_ids(self.dataset.ids).then(function(rows)
return self.dataset.read_ids(self.dataset.ids, self.fields).then(function(rows)
{
// setup data structure
_.each(rows, function(row)
Expand Down Expand Up @@ -369,6 +369,7 @@ odoo.define('web_widget_x2many_2d_matrix.widget', function (require) {
$this.val(this.format_xy_value(value));

this.dataset.write($this.data('id'), data);
this.by_id[$this.data('id')][this.field_value] = value;
$this.parent().removeClass('oe_form_invalid');
this.compute_totals();
}
Expand All @@ -382,7 +383,7 @@ odoo.define('web_widget_x2many_2d_matrix.widget', function (require) {
effective_readonly_change: function()
{
this.$el
.find('tbody .read')
.find('tbody .edit')
.toggle(!this.get('effective_readonly'));
this.$el
.find('tbody .read')
Expand All @@ -404,6 +405,9 @@ odoo.define('web_widget_x2many_2d_matrix.widget', function (require) {
return $.when(result).then(function()
{
self.renderElement();
self.compute_totals();
self.$el.find('.edit').on(
'change', self.proxy(self.xy_value_change));
});
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
<th><t t-esc="widget.get_y_axis_label(y)" /></th>
<td t-foreach="widget.get_x_axis_values()" t-as="x" t-att-class="'' + (widget.is_numeric ? ' oe_number' : '')" t-att-data-x="x">
<span t-att-class="widget.get_xy_value_class()">
<input class="edit o_form_input" t-att-data-id="widget.get_xy_id(x, y)" t-att-value="widget.format_xy_value(widget.get_xy_value(x, y))" t-att="widget.get_xy_att(x, y)"/>
<span class="read"><t t-esc="widget.format_xy_value(widget.get_xy_value(x, y))" /></span>
<input class="edit o_form_input oe_edit_only" t-att-data-id="widget.get_xy_id(x, y)" t-att-value="widget.format_xy_value(widget.get_xy_value(x, y))" t-att="widget.get_xy_att(x, y)"/>
<span class="read oe_read_only"><t t-esc="widget.format_xy_value(widget.get_xy_value(x, y))" /></span>
</span>
</td>
<td t-if="widget.show_row_totals" class="row_total oe_number" t-att-data-y="y"/>
Expand Down

0 comments on commit 71c5a46

Please sign in to comment.