[FIX] web: Handle time select in modal with firefox

Issue

	- Install sale_renting
	- Create a rental order
	- Add a "rental" product
	- In Modal, change start or end time

	In Firefox, user not allowed to change the time;
	time select not reacting well.

Cause

	The issue seems to be that in bootstrap when
	we click outside a modal, we focus on the modal:

	https://github.com/odoo/odoo/blob/27f67bfcb903/addons/web/static/lib/bootstrap/js/modal.js#L332-L337

	and the FieldDateRange widget contains a <select/> tag
	and is added outside of the modal, so when we click
	on the select, bootstrap will focus on the modal which
	in firefox seems to lose the focus on the <select/>
	which get closed.

Solution

	not propagating focusin event when the select of the
	daterange widget is focused => in my opinion this is
	the less risky solution, this could be done with a
	code such as (in the FieldDateRange._renderEdit method):

opw-2240220

closes odoo/odoo#50906

X-original-commit: 5a1e9e32061996ca1770c9ae9b5a7e7f53c5048f
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
This commit is contained in:
Nasreddin (bon)
2020-05-08 10:52:12 +00:00
parent e09120a1d6
commit f427a38c4e
@@ -705,6 +705,11 @@ var FieldDateRange = InputField.extend({
self.$el.data('daterangepicker').hide();
}
});
// Prevent bootstrap from focusing on modal (which breaks hours drop-down in firefox)
this.$pickerContainer.on('focusin.bs.modal', 'select', function (ev) {
ev.stopPropagation();
});
},
});