From f34a7c3a4723cb43b3f4b60a0a6b27032b6aa58b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20=C3=89vrard?= Date: Fri, 18 Sep 2026 23:52:09 +0200 Subject: [PATCH] Support getting and setting tree widths without a screen width Closes #15099 (grafted from bdec2127549993b25a44c2057a3f2b7a824ecdc2) --HG-- branch : 8.0 --- trytond/trytond/ir/ui/view.py | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/trytond/trytond/ir/ui/view.py b/trytond/trytond/ir/ui/view.py index 45aba9b029..97a227866e 100644 --- a/trytond/trytond/ir/ui/view.py +++ b/trytond/trytond/ir/ui/view.py @@ -471,8 +471,9 @@ class ViewTreeWidth( ondelete='CASCADE') screen_width = fields.Integer( "Screen Width", - domain=[ + domain=['OR', ('screen_width', '>=', 0), + ('screen_width', '=', None), ]) width = fields.Integer( "Width", @@ -542,11 +543,14 @@ class ViewTreeWidth( @classmethod def get_width(cls, model, width): - for screen_width in WIDTH_BREAKPOINTS: - if width >= screen_width: - break - else: + if width is None: screen_width = None + else: + for screen_width in WIDTH_BREAKPOINTS: + if width >= screen_width: + break + else: + screen_width = None user = Transaction().user records = cls.search([ @@ -591,11 +595,14 @@ class ViewTreeWidth( as value. width is the screen width. ''' - for screen_width in WIDTH_BREAKPOINTS: - if width >= screen_width: - break - else: + if width is None: screen_width = None + else: + for screen_width in WIDTH_BREAKPOINTS: + if width >= screen_width: + break + else: + screen_width = None user_id = Transaction().user records = cls.search([