details:   https://code.tryton.org/tryton/commit/e2ac0b562e5b
branch:    default
user:      Cédric Krier <[email protected]>
date:      Fri Apr 03 18:16:39 2026 +0200
description:
        Display the number of records being deleted in the confirmation message

        Closes #14745
diffstat:

 sao/src/tab.js                   |   9 ++++++---
 tryton/tryton/gui/window/form.py |  11 +++++++++--
 2 files changed, 15 insertions(+), 5 deletions(-)

diffs (51 lines):

diff -r 1d788729c663 -r e2ac0b562e5b sao/src/tab.js
--- a/sao/src/tab.js    Fri Apr 03 17:06:49 2026 +0200
+++ b/sao/src/tab.js    Fri Apr 03 18:16:39 2026 +0200
@@ -992,12 +992,15 @@
                 || !this.screen.deletable) {
                 return jQuery.when();
             }
-            var msg;
+            let size;
             if (this.screen.current_view.view_type == 'form') {
-                msg = Sao.i18n.gettext('Are you sure to remove this record?');
+                size = 1;
             } else {
-                msg = Sao.i18n.gettext('Are you sure to remove those 
records?');
+                size = this.screen.selected_records.length;
             }
+            let msg = Sao.i18n.ngettext(
+                "Are you sure you want to delete this record?",
+                "Are you sure you want to delete these %1 records?", size, 
size);
             return Sao.common.sur.run(msg).then(() => {
                 return this.screen.remove(true, false, true).then(
                     () => {
diff -r 1d788729c663 -r e2ac0b562e5b tryton/tryton/gui/window/form.py
--- a/tryton/tryton/gui/window/form.py  Fri Apr 03 17:06:49 2026 +0200
+++ b/tryton/tryton/gui/window/form.py  Fri Apr 03 18:16:39 2026 +0200
@@ -31,6 +31,7 @@
 from .tabcontent import TabContent
 
 _ = gettext.gettext
+N_ = gettext.ngettext
 
 
 class Form(TabContent):
@@ -414,9 +415,15 @@
                 or not self.screen.deletable):
             return
         if self.screen.current_view.view_type == 'form':
-            msg = _('Are you sure to remove this record?')
+            size = 1
         else:
-            msg = _('Are you sure to remove those records?')
+            size = len(self.screen.selected_records)
+        msg = N_(
+            "Are you sure you want to delete this record?",
+            "Are you sure you want to delete these %(size)d records?",
+            size) % {
+                'size': size,
+                }
         if sur(msg):
             if not self.screen.remove(delete=True, force_remove=True):
                 self.info_bar_add(

Reply via email to