From f82ab99c1aa110aa6a28a2787402da09b7ea311e Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Fri, 21 Oct 2016 17:30:59 +0200 Subject: [FIX] web: BufferedDataSet write to length field Underscore method _.each expects an array like object when a "length" property is present. This was an issue with a record having a numeric "length" field set to a non-negative value. opw-691070 --- addons/web/static/src/js/framework/data.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/js/framework/data.js b/addons/web/static/src/js/framework/data.js index 7287070013a..005ceb1fb1e 100644 --- a/addons/web/static/src/js/framework/data.js +++ b/addons/web/static/src/js/framework/data.js @@ -799,18 +799,19 @@ var BufferedDataSet = DataSetStatic.extend({ var def = $.Deferred(); this.mutex.exec(function () { var dirty = false; - _.each(data, function (v, k) { - if (!_.isEqual(v, cached.values[k])) { + // _.each is broken if a field "length" is present + for (var k in data) { + if (!_.isEqual(data[k], cached.values[k])) { dirty = true; - if (_.isEqual(v, cached.from_read[k])) { // clean changes + if (_.isEqual(data[k], cached.from_read[k])) { // clean changes delete cached.changes[k]; } else { - cached.changes[k] = v; + cached.changes[k] = data[k]; } } else { delete data[k]; } - }); + } self._update_cache(id, options); if (dirty) { -- cgit v1.2.3 From 1f06cc41684af15bc777da0024d66911e0c92990 Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Mon, 24 Oct 2016 12:15:18 +0200 Subject: [FIX] web: list editable: traceback when removing a row in edition When clicking on the trash to remove a line (e.g. a sale order line in a quotation form view) while editing another line, it produces a traceback (in most cases), or behaves randomly (less frequently) like removing both lines, or one of them, or maybe none of them. Anyway, this feature doesn't work at all, so this commit simply disables it when we are in edition mode. In a perfect world, we would fix the feature instead of disabling it, but the code of the list editable is so instable that it would most certainly break something else. Closes #13778 --- addons/web/static/src/css/base.css | 4 ++++ addons/web/static/src/css/base.sass | 3 +++ 2 files changed, 7 insertions(+) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index dfc127f7c65..4a2d5f81bb2 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -2224,6 +2224,10 @@ .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_form_field_reference { display: table; } +.openerp .oe_list.oe_list_editable.oe_editing .oe_list_record_delete { + opacity: 0.5; + pointer-events: none; +} .openerp .oe_list_group_name { white-space: nowrap; } diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index f11fb0a76df..7ba9e6bece3 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -1909,6 +1909,9 @@ $sheet-padding: 16px width: calc(100% - 20px) &.oe_form_field_reference display: table + .oe_list_record_delete + opacity: 0.5 + pointer-events: none .oe_list_group_name white-space: nowrap // }}} -- cgit v1.2.3 From 25616b9f2bbca3f03dbde1dc81a57986241c1aab Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Fri, 21 Oct 2016 17:10:57 +0200 Subject: [FIX] web: repair length field in view list Underscore method _.each expects an array like object when a "length" property is present. This was an issue with a record having a numeric "length" field set to a non-negative value. When changing a line the change would not appear on blur. This issue was fixed with 0e664c9e9 but introduced back with f0e331e00. opw-691070 Forward-port of 5d17749ff47c02294d5ff2ae56bbcef9d082562e which has been forgotten during previous forward-port. --- addons/web/static/src/js/views/list_view.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/js/views/list_view.js b/addons/web/static/src/js/views/list_view.js index 301b3936d02..3e01ea0c4f6 100644 --- a/addons/web/static/src/js/views/list_view.js +++ b/addons/web/static/src/js/views/list_view.js @@ -560,11 +560,12 @@ var ListView = View.extend( /** @lends instance.web.ListView# */ { self.records.remove(record); return; } - _.each(values, function (value, key) { + // _.each is broken if a field "length" is present + for (var key in values) { if (fields[key] && fields[key].type === 'many2many') record.set(key + '__display', false, {silent: true}); - record.set(key, value, {silent: true}); - }); + record.set(key, values[key], {silent: true}); + } record.trigger('change', record); /* When a record is reloaded, there is a rendering lag because of the addition/suppression of -- cgit v1.2.3