From 28259a7fb78658b1b7f4e5ec37b6882017a84d89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 12 Aug 2008 19:33:37 +0200 Subject: [PATCH] Improve many2one field if the internal value is not a tuple --- tryton/gui/window/view_form/model/field.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tryton/gui/window/view_form/model/field.py b/tryton/gui/window/view_form/model/field.py index 18648430e9..88cfec868c 100644 --- a/tryton/gui/window/view_form/model/field.py +++ b/tryton/gui/window/view_form/model/field.py @@ -244,12 +244,20 @@ class M2OField(CharField): def get(self, model, check_load=True, readonly=True, modified=False): if model.value[self.name]: + if isinstance(model.value[self.name], (int, basestring, long)): + self.set(model, model.value[self.name]) + if isinstance(model.value[self.name], (int, basestring, long)): + return model.value[self.name] return model.value[self.name][0] or False return False def get_client(self, model): #model._check_load() if model.value[self.name]: + if isinstance(model.value[self.name], (int, basestring, long)): + self.set(model, model.value[self.name]) + if isinstance(model.value[self.name], (int, basestring, long)): + return model.value[self.name] return model.value[self.name][1] return False