[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 <dam@odoo.com>
This commit is contained in:
FrancoisGe
2023-05-09 11:57:17 +02:00
parent 28075c915b
commit 4cd313306b
@@ -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 &&