changeset 80663838f18b in sao:5.0
details: https://hg.tryton.org/sao?cmd=changeset;node=80663838f18b
description:
        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
        (grafted from ee651d2da2519ceb8f5a627a6aaf8b34eb88a32e)
diffstat:

 src/common.js |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (18 lines):

diff -r 93e2e0c28f62 -r 80663838f18b src/common.js
--- a/src/common.js     Mon Jan 18 23:29:44 2021 +0100
+++ b/src/common.js     Fri Jan 22 01:11:08 2021 +0100
@@ -1929,9 +1929,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 || '';

Reply via email to