[FIX] web_widget_x2many_2d_matrix: fixes (#712)

* Patches to make module operational.
* Minor fix to Readonly Switch
* Fix to render to set change attribute.
* Totals recompute.

Fixes #697
This commit is contained in:
Richard deMeester
2017-08-31 01:03:06 +10:00
committed by Simone Orsi
parent 22aaa168c8
commit 92c1f86066
3 changed files with 9 additions and 5 deletions

View File

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