Skip to content
Permalink
Browse files

[FIX] web: list: multi edit: do not create new row

...when validating last row by pressing ENTER.

In single edition, we automatically add a new row when the user
edits the last one and presses ENTER. This is something we don't
want in multi edition.

Task 2068280
  • Loading branch information...
aab-odoo committed Sep 11, 2019
1 parent 45078f6 commit 8863457e54f043abf870675005499f2345b2c401
@@ -648,11 +648,8 @@ var ListController = BasicController.extend({
this.fieldChangedPrevented = ev;
} else if (this._inMultipleRecordEdition(ev.data.dataPointID)) {
// deal with edition of multiple lines
var _onSuccess = ev.data.onSuccess;
ev.data.onSuccess = function () {
Promise.resolve(_onSuccess()).then(function () {
self._saveMultipleRecords(ev.data.dataPointID, ev.target.__node, ev.data.changes);
});
return self._saveMultipleRecords(ev.data.dataPointID, ev.target.__node, ev.data.changes);
};
}
this._super.apply(this, arguments);
@@ -4661,6 +4661,40 @@ QUnit.module('Views', {
list.destroy();
});

QUnit.only('editable list view: multi edition: edit and validate last row', async function (assert) {
assert.expect(3);

var list = await createView({
View: ListView,
model: 'foo',
data: this.data,
arch: '<tree editable="bottom">' +
'<field name="foo"/>' +
'<field name="int_field"/>' +
'</tree>',
fieldDebounce: 100,
});

assert.containsN(list, '.o_data_row', 4);

// select all records
await testUtils.dom.click(list.$('.o_list_view thead .o_list_record_selector input'));

// edit a last cell of last line
await testUtils.dom.click(list.$('.o_data_row:last .o_data_cell:last'));
list.$('.o_field_widget[name=int_field]').val('666');
testUtils.fields.editInput(list.$('.o_field_widget[name=int_field]'), '666');
await testUtils.fields.triggerKeydown(list.$('tr.o_selected_row .o_data_cell:last input'), 'enter');

assert.containsOnce(document.body, '.modal');
await testUtils.dom.click($('.modal .btn-primary'));

assert.containsN(list, '.o_data_row', 4,
"should not create a new row as we were in multi edition");

list.destroy();
});

QUnit.test('list grouped by date:month', async function (assert) {
assert.expect(1);

0 comments on commit 8863457

Please sign in to comment.
You can’t perform that action at this time.