details:   https://code.tryton.org/tryton/commit/bdec21275499
branch:    default
user:      Nicolas Évrard <[email protected]>
date:      Fri Sep 18 23:52:09 2026 +0200
description:
        Support getting and setting tree widths without a screen width

        Closes #15099
diffstat:

 trytond/trytond/ir/ui/view.py |  25 ++++++++++++++++---------
 1 files changed, 16 insertions(+), 9 deletions(-)

diffs (52 lines):

diff -r 20aaef9f4017 -r bdec21275499 trytond/trytond/ir/ui/view.py
--- a/trytond/trytond/ir/ui/view.py     Mon Aug 24 15:10:12 2026 +0200
+++ b/trytond/trytond/ir/ui/view.py     Fri Sep 18 23:52:09 2026 +0200
@@ -475,8 +475,9 @@
         ondelete='CASCADE')
     screen_width = fields.Integer(
         "Screen Width",
-        domain=[
+        domain=['OR',
             ('screen_width', '>=', 0),
+            ('screen_width', '=', None),
             ])
     width = fields.Integer(
         "Width",
@@ -546,11 +547,14 @@
 
     @classmethod
     def get_width(cls, model, width):
-        for screen_width in WIDTH_BREAKPOINTS:
-            if width >= screen_width:
-                break
+        if width is None:
+            screen_width = None
         else:
-            screen_width = None
+            for screen_width in WIDTH_BREAKPOINTS:
+                if width >= screen_width:
+                    break
+            else:
+                screen_width = None
 
         user = Transaction().user
         records = cls.search([
@@ -595,11 +599,14 @@
         as value.
         width is the screen width.
         '''
-        for screen_width in WIDTH_BREAKPOINTS:
-            if width >= screen_width:
-                break
+        if width is None:
+            screen_width = None
         else:
-            screen_width = None
+            for screen_width in WIDTH_BREAKPOINTS:
+                if width >= screen_width:
+                    break
+            else:
+                screen_width = None
 
         user_id = Transaction().user
         records = cls.search([

Reply via email to