summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js
diff options
context:
space:
mode:
authorAnh Thao Pham (pta) <pta@odoo.com>2021-05-20 12:35:13 +0000
committerAnh Thao Pham (pta) <pta@odoo.com>2021-05-21 07:10:35 +0000
commit030edd35ec14c434f9598578530b5704ea1cc459 (patch)
treea4173e039cca266e63a0cf745c9b82dc66f062a9 /addons/web/static/src/js
parentef2d4f62e04c110fa6d36fa52ba4bfcc079d209f (diff)
[FIX] web: fix crash on editable list view when moving over a RO field
This is a forward-port of commit https://github.com/odoo/odoo/commit/970387f91fea0cb47404612f7d519ffba2c9ad3b In editable list view, moving to next cell using TAB key crash when the following field is becoming read-only (i.e non-focusable) and an onchange() event is triggered. Consider an editable tree view like this: <form> <field name="o2m" onchange="1"> <tree> <field name="description"/> <field name="date" attrs="{'readonly': [('description', '!=', False)]}"/> <field name="type"/> </tree> </field> </form> 1. Edit 'description' 2. Issue a TAB keypress before 'date' becomes read-only It will crash while calling getSelectionRange() on an empty element. opw-2523630 closes odoo/odoo#71122 X-original-commit: bd6ba50e073ffff0bd51b1a02d51260f09e36357 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com> Signed-off-by: Anh Thao PHAM <kitan191@users.noreply.github.com>
Diffstat (limited to 'addons/web/static/src/js')
-rw-r--r--addons/web/static/src/js/views/list/list_editable_renderer.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/addons/web/static/src/js/views/list/list_editable_renderer.js b/addons/web/static/src/js/views/list/list_editable_renderer.js
index a3c47684991..26e2db8c234 100644
--- a/addons/web/static/src/js/views/list/list_editable_renderer.js
+++ b/addons/web/static/src/js/views/list/list_editable_renderer.js
@@ -263,7 +263,7 @@ ListRenderer.include({
currentWidget = self.allFieldWidgets[currentRowID][self.currentFieldIndex];
if (currentWidget) {
focusedElement = currentWidget.getFocusableElement().get(0);
- if (currentWidget.formatType !== 'boolean') {
+ if (currentWidget.formatType !== 'boolean' && focusedElement) {
selectionRange = dom.getSelectionRange(focusedElement);
}
}