From 7167b9224ee6d9936edcf959b2458f5babae01ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 28 Sep 2019 23:23:01 +0200 Subject: [PATCH] Do not use record in __init__ of form widget During the initialization of the widget, the view may not yet have a proper record. But update_img access the record of the view. Also it is safer for list-form to define the _record before calling super in case there is an access to record attribute. issue8616 review285981002 --- tryton/gui/window/view_form/view/form_gtk/image.py | 2 -- tryton/gui/window/view_form/view/list_form.py | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/tryton/gui/window/view_form/view/form_gtk/image.py b/tryton/gui/window/view_form/view/form_gtk/image.py index 18fc047b6b..7a60fc9765 100644 --- a/tryton/gui/window/view_form/view/form_gtk/image.py +++ b/tryton/gui/window/view_form/view/form_gtk/image.py @@ -44,8 +44,6 @@ class Image(BinaryMixin, Widget): self._readonly = False - self.update_img() - @property def filters(self): filters = super(Image, self).filters diff --git a/tryton/gui/window/view_form/view/list_form.py b/tryton/gui/window/view_form/view/list_form.py index 988e728e3c..e80abca260 100644 --- a/tryton/gui/window/view_form/view/list_form.py +++ b/tryton/gui/window/view_form/view/list_form.py @@ -10,8 +10,8 @@ from .form import ViewForm class ListBoxViewForm(ViewForm): def __init__(self, view_id, screen, xml): - super().__init__(view_id, screen, xml) self._record = None + super().__init__(view_id, screen, xml) self.scroll.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.NEVER) @property