From 4cd313306bf2c640caf600670dc8ff3dbac81e4f Mon Sep 17 00:00:00 2001 From: FrancoisGe Date: Thu, 4 May 2023 13:41:47 +0000 Subject: [PATCH] [FIX] web: remove useless checkValidity In this commit, we will remove unnecessary uses of the checkValidity function. In the ListRenderer, during a keydown, we do if checkValidity but it is an async function so the condition is always true. We have checked the calls and they are probably unnecessary because the add(...) function will perform a checkValidity. closes odoo/odoo#120619 Signed-off-by: Mathieu Duckerts-Antoine --- addons/web/static/src/views/list/list_renderer.js | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/addons/web/static/src/views/list/list_renderer.js b/addons/web/static/src/views/list/list_renderer.js index 5732536dc63..831ff8fd513 100644 --- a/addons/web/static/src/views/list/list_renderer.js +++ b/addons/web/static/src/views/list/list_renderer.js @@ -1308,14 +1308,10 @@ export class ListRenderer extends Component { const isDirty = record.isDirty || this.lastIsDirty; const isEnterBehavior = hotkey === "enter" && (!record.canBeAbandoned || isDirty); const isTabBehavior = hotkey === "tab" && !record.canBeAbandoned && isDirty; - if (isEnterBehavior && !record.checkValidity()) { - return true; - } if ( isLastOfGroup && this.canCreate && editable === "bottom" && - record.checkValidity() && (isEnterBehavior || isTabBehavior) ) { this.add({ group }); @@ -1387,10 +1383,8 @@ export class ListRenderer extends Component { return false; } // add a line - if (record.checkValidity()) { - const { context } = this.creates[0]; - this.add({ context }); - } + const { context } = this.creates[0]; + this.add({ context }); } else if ( this.canCreate && !record.canBeAbandoned &&