From 9cb5543f9d72bf66313f6cd20ab2df632d5afc01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 22 Jan 2021 01:11:08 +0100 Subject: [PATCH] Fall-back to internal selection value if selection is a string When DomainParser format a domain from a DomainValidationError, the field definition may contain as selection as string. At this place we can not really make an other RPC call to convert the selection so we fall-back to the internal value. issue9989 review349271002 --- src/common.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/common.js b/src/common.js index 2578d32f0f..3fa0d08a79 100644 --- a/src/common.js +++ b/src/common.js @@ -2005,9 +2005,11 @@ return (value * factor).toFixed(digit); }; var format_selection = function() { - for (var i = 0; i < field.selection.length; i++) { - if (field.selection[i][0] == value) { - return field.selection[i][1]; + if (field.selection instanceof Array) { + for (var i = 0; i < field.selection.length; i++) { + if (field.selection[i][0] == value) { + return field.selection[i][1]; + } } } return value || '';