[FIX] web: avoid SelectCreateDialog editable list view
As its name indicates, the SelectCreateDialog is meant to select and create, not edit. If the view is editable, clicking on an element will edit it instead of selecting it. For this reason, the view is set in `readonly` even if the view arch uses the attribute `editable`. Before this rev., you couldn't select a "Close Reason" when closing a subscription (in "Search More").
This commit is contained in:
@@ -343,6 +343,7 @@ var SelectCreateDialog = ViewDialog.extend({
|
||||
groupBy: searchResult.groupBy,
|
||||
modelName: self.dataset.model,
|
||||
hasSelectors: !self.options.disable_multiple_selection,
|
||||
readonly: true,
|
||||
}, self.options.list_view_options));
|
||||
listView.setController(SelectCreateListController);
|
||||
return listView.getController(self);
|
||||
|
||||
@@ -140,6 +140,35 @@ QUnit.module('Views', {
|
||||
dialog.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('SelectCreateDialog list view in readonly', function (assert) {
|
||||
assert.expect(1);
|
||||
|
||||
var parent = createParent({
|
||||
data: this.data,
|
||||
archs: {
|
||||
'partner,false,list':
|
||||
'<tree string="Partner" editable="bottom">' +
|
||||
'<field name="display_name"/>' +
|
||||
'<field name="foo"/>' +
|
||||
'</tree>',
|
||||
'partner,false,search':
|
||||
'<search/>'
|
||||
},
|
||||
});
|
||||
|
||||
var dialog = new dialogs.SelectCreateDialog(parent, {
|
||||
res_model: 'partner',
|
||||
}).open();
|
||||
|
||||
// click on the first row to see if the list is editable
|
||||
dialog.$('.o_list_view tbody tr:first td:not(.o_list_record_selector):first').click();
|
||||
|
||||
assert.equal(dialog.$('.o_list_view tbody tr:first td:not(.o_list_record_selector):first input').length, 0,
|
||||
"list view should not be editable in a SelectCreateDialog");
|
||||
|
||||
dialog.destroy();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user