summaryrefslogtreecommitdiff
path: root/addons/web
diff options
context:
space:
mode:
authorMartin Geubelle <mge@odoo.com>2018-02-05 16:56:54 +0100
committerMartin Geubelle <mge@odoo.com>2018-02-07 15:25:54 +0100
commit36d07bfc0f5b9841b17f4cfdf2ffb029ea1280e0 (patch)
tree466d4cf466c548f043e05654cb521adda62149b3 /addons/web
parent4ae44b3bd9022813e7b334e3fc19567b0c7c1e7a (diff)
[FIX] web: properly handles ESC in editable lists
This is a small correction of odoo/odoo@3aad756 ; a traceback occured when ESC was pressed in a list view with modifiers. The `confirmChange` was done on the parent datapoint (of type list) which has no attribute `evalModifiers`. `confirmChange` is now called on the record datapoint. Note that for x2m, it means that all modifiers linked to the parent record won't be re-evaluated (but this wasn't probably intended as this is a bit overkill). Closes #22718
Diffstat (limited to 'addons/web')
-rw-r--r--addons/web/static/src/js/views/basic/basic_controller.js2
-rw-r--r--addons/web/static/tests/views/list_tests.js22
2 files changed, 23 insertions, 1 deletions
diff --git a/addons/web/static/src/js/views/basic/basic_controller.js b/addons/web/static/src/js/views/basic/basic_controller.js
index 5fc68e3124e..c7345a22ccc 100644
--- a/addons/web/static/src/js/views/basic/basic_controller.js
+++ b/addons/web/static/src/js/views/basic/basic_controller.js
@@ -511,7 +511,7 @@ var BasicController = AbstractController.extend(FieldManagerMixin, {
// TODO this will tell the renderer to rerender the widget that
// asked for the discard but will unfortunately lose the click
// made on another row if any
- self._confirmChange(self.handle, [ev.data.fieldName], ev)
+ self._confirmChange(recordID, [ev.data.fieldName], ev)
.always(ev.data.onSuccess);
})
.fail(ev.data.onFailure);
diff --git a/addons/web/static/tests/views/list_tests.js b/addons/web/static/tests/views/list_tests.js
index 33b44948fca..b03e3ff534d 100644
--- a/addons/web/static/tests/views/list_tests.js
+++ b/addons/web/static/tests/views/list_tests.js
@@ -2772,6 +2772,28 @@ QUnit.module('Views', {
list.destroy();
});
+ QUnit.test('pressing ESC discard the current line changes (with required)', function (assert) {
+ assert.expect(3);
+
+ var list = createView({
+ View: ListView,
+ model: 'foo',
+ data: this.data,
+ arch: '<tree editable="top"><field name="foo" required="1"/></tree>',
+ });
+
+ list.$buttons.find('.o_list_button_add').click();
+
+ list.$('input[name="foo"]').trigger({type: 'keydown', which: $.ui.keyCode.ESCAPE});
+ assert.strictEqual(list.$('tr.o_data_row').length, 4,
+ "should have 4 data row in list");
+ assert.strictEqual(list.$('tr.o_data_row.o_selected_row').length, 0,
+ "no rows should be selected");
+ assert.ok(!list.$buttons.find('.o_list_button_save').is(':visible'),
+ "should not have a visible save button");
+ list.destroy();
+ });
+
QUnit.test('field with password attribute', function (assert) {
assert.expect(2);