[FIX] web: broken listview dropdown on state_selection

Before this commit: when clicking on an editable state_selection widget in
listview, the dropdown is not displayed. this is happening because overflow
of cell was hidden.

After this commit: when clicking on an editable state_selection widget in
listview, the dropdown is displayed. change overflow to visible for
state_selection column. Also fixed the issue when selecting option from
state_selection widget row was get edited or if it is not editable listview
then view is swithed to form view, it is because of event propagation which
we stopped here.

Task - 2485883

closes odoo/odoo#68129

Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
Co-authored-by: Mohammed Shekha <msh@odoo.com>
This commit is contained in:
yograj tandel
2021-07-07 13:36:11 +00:00
committed by Mohammed Shekha
co-authored by Mohammed Shekha
parent 0a2ec2f6d5
commit 3603654006
3 changed files with 6 additions and 2 deletions
@@ -2682,6 +2682,9 @@ var StateSelectionWidget = AbstractField.extend({
*/
_setSelection: function (ev) {
ev.preventDefault();
if (this.mode !== 'edit') {
ev.stopPropagation();
}
var $item = $(ev.currentTarget);
var value = String($item.data('value'));
this._setValue(value);
@@ -28,7 +28,7 @@
}
}
tbody > tr > td:not(.o_list_record_selector) {
&:not(.o_handle_cell):not(.o_list_button) {
&:not(.o_handle_cell):not(.o_list_button):not(.o_state_selection_cell) {
@include o-text-overflow(table-cell);
&.o_list_text {
white-space: pre-wrap;
@@ -6501,7 +6501,7 @@ QUnit.module('basic_fields', {
});
QUnit.test('state_selection widget in editable list view', async function (assert) {
assert.expect(32);
assert.expect(33);
var list = await createView({
View: ListView,
@@ -6542,6 +6542,7 @@ QUnit.module('basic_fields', {
"should still have one green status");
assert.containsNone(list, '.dropdown-menu.state:visible',
"there should not be a dropdown");
assert.containsNone(list, 'tr.o_selected_row', 'should not be in edit mode');
// switch to edit mode and check the result
$cell = list.$('tbody td.o_state_selection_cell').first();