[IMP] web: adapt multi edit feature to list selection changes
We don't change the multi edit mechanism for now: it still only applies to the selected records, limited to the current page. However, we add the information in the confirm dialog to make it clear for the user. Part of task 2185145
This commit is contained in:
@@ -22,6 +22,8 @@ const ListConfirmDialog = Dialog.extend({
|
||||
* @param {Widget} parent
|
||||
* @param {Object} record edited record with updated value
|
||||
* @param {Object} changes changes registered by the list controller
|
||||
* @param {Object} changes isDomainSelected true iff the user selected the
|
||||
* whole domain
|
||||
* @param {string} changes.fieldLabel label of the changed field
|
||||
* @param {string} changes.fieldName technical name of the changed field
|
||||
* @param {number} changes.nbRecords number of records (total)
|
||||
|
||||
@@ -464,6 +464,7 @@ var ListController = BasicController.extend({
|
||||
};
|
||||
const record = this.model.get(recordId);
|
||||
const dialogChanges = {
|
||||
isDomainSelected: this.isDomainSelected,
|
||||
fieldLabel: node.attrs.string || record.fields[fieldName].string,
|
||||
fieldName: node.attrs.name,
|
||||
nbRecords: recordIds.length,
|
||||
|
||||
@@ -874,6 +874,7 @@
|
||||
<t t-name="ListView.confirmModal">
|
||||
<main role="alert">
|
||||
<p>
|
||||
<t t-if="changes.isDomainSelected">This update will only consider the records of the current page.<br/><br/></t>
|
||||
<t t-if="changes.nbRecords != changes.nbValidRecords">
|
||||
Among the <t t-raw="changes.nbRecords"/> selected records,
|
||||
<t t-raw="changes.nbValidRecords"/> are valid for this update.<br/>
|
||||
|
||||
@@ -6340,6 +6340,33 @@ QUnit.module('Views', {
|
||||
list.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('editable list view: multi edition when the domain is selected', async function (assert) {
|
||||
assert.expect(1);
|
||||
|
||||
const list = await createView({
|
||||
View: ListView,
|
||||
model: 'foo',
|
||||
data: this.data,
|
||||
arch: `
|
||||
<tree multi_edit="1" limit="2">
|
||||
<field name="id"/>
|
||||
<field name="int_field"/>
|
||||
</tree>`,
|
||||
});
|
||||
|
||||
// select all records, and then select all domain
|
||||
await testUtils.dom.click(list.$('th.o_list_record_selector input'));
|
||||
await testUtils.dom.click(list.$('.o_list_selection_box .o_list_select_domain'));
|
||||
|
||||
// edit a field
|
||||
await testUtils.dom.click(list.$('.o_data_row:eq(0) .o_data_cell:eq(1)'));
|
||||
await testUtils.fields.editInput(list.$('.o_field_widget[name=int_field]'), 666);
|
||||
|
||||
assert.ok($('.modal-body').text().includes('This update will only consider the records of the current page.'));
|
||||
|
||||
list.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('editable list view: many2one with readonly modifier', async function (assert) {
|
||||
assert.expect(2);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user