From 20fa476c9ca26c315bed8aae621fde8a8b6b0303 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 16 Nov 2023 18:22:04 +0100 Subject: [PATCH] Use screen methods to activate or not the next/previous buttons of attachment preview Closes #12756 (grafted from cf043bb57421ab47f68cf8cc41745489cf0187d4) --HG-- branch : 7.0 --- sao/src/tab.js | 4 ++-- tryton/tryton/gui/window/form.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sao/src/tab.js b/sao/src/tab.js index 411b61a9b6..038c0185de 100644 --- a/sao/src/tab.js +++ b/sao/src/tab.js @@ -1283,8 +1283,8 @@ preview.record_message = function(position, length) { var text = (position || '_') + '/' + length; label.text(text).attr('title', text); - but_prev.prop('disabled', !position || position <= 1); - but_next.prop('disabled', !position || position >= length); + but_prev.prop('disabled', !screen.has_previous()); + but_next.prop('disabled', !screen.has_next()); }; screen.windows.push(preview); diff --git a/tryton/tryton/gui/window/form.py b/tryton/tryton/gui/window/form.py index cbe2d08392..63ba093f6d 100644 --- a/tryton/tryton/gui/window/form.py +++ b/tryton/tryton/gui/window/form.py @@ -219,8 +219,8 @@ class Form(TabContent): class Preview(): def record_message(self, position, length, *args): label.set_text('(%s/%s)' % (position or '_', length)) - but_prev.set_sensitive(position and position > 1) - but_next.set_sensitive(position and position < length) + but_prev.set_sensitive(screen.has_prev()) + but_next.set_sensitive(screen.has_next()) screen.windows.append(Preview()) vbox.pack_start(screen.widget, expand=True, fill=True, padding=0)