details:   https://code.tryton.org/tryton/commit/c80a43510702
branch:    default
user:      Cédric Krier <[email protected]>
date:      Thu Jul 16 16:08:38 2026 +0200
description:
        Use ngettext for warning message about pending purchases of outsourced 
productions
diffstat:

 modules/production_outsourcing/message.xml   |   9 ++++++---
 modules/production_outsourcing/production.py |  12 ++++++++----
 2 files changed, 14 insertions(+), 7 deletions(-)

diffs (67 lines):

diff -r 5492328ef6dd -r c80a43510702 modules/production_outsourcing/message.xml
--- a/modules/production_outsourcing/message.xml        Thu Jul 16 15:58:16 
2026 +0200
+++ b/modules/production_outsourcing/message.xml        Thu Jul 16 16:08:38 
2026 +0200
@@ -4,13 +4,16 @@
 <tryton>
     <data grouped="1">
         <record model="ir.message" id="msg_pending_purchase_draft">
-            <field name="text">The productions "%(productions)s" cannot be 
reset to draft as they have pending purchases.</field>
+            <field name="text">The production "%(productions)s" cannot be 
reset to draft as it has pending purchases.</field>
+            <field name="text_plural">The productions "%(productions)s" cannot 
be reset to draft as they have pending purchases.</field>
         </record>
         <record model="ir.message" id="msg_pending_purchase_cancel">
-            <field name="text">The productions "%(productions)s" cannot be 
cancelled as they have pending purchases.</field>
+            <field name="text">The production "%(productions)s" cannot be 
cancelled as it has pending purchases.</field>
+            <field name="text_plural">The productions "%(productions)s" cannot 
be cancelled as they have pending purchases.</field>
         </record>
         <record model="ir.message" id="msg_pending_purchase_done">
-            <field name="text">The productions "%(productions)s" cannot be 
processed as they have pending purchases.</field>
+            <field name="text">The production "%(productions)s" cannot be 
processed as it has pending purchases.</field>
+            <field name="text_plural">The productions "%(productions)s" cannot 
be processed as they have pending purchases.</field>
         </record>
     </data>
 </tryton>
diff -r 5492328ef6dd -r c80a43510702 
modules/production_outsourcing/production.py
--- a/modules/production_outsourcing/production.py      Thu Jul 16 15:58:16 
2026 +0200
+++ b/modules/production_outsourcing/production.py      Thu Jul 16 16:08:38 
2026 +0200
@@ -3,7 +3,7 @@
 
 from itertools import groupby
 
-from trytond.i18n import gettext
+from trytond.i18n import ngettext
 from trytond.model import ModelView, Workflow, fields
 from trytond.modules.product import round_price
 from trytond.pool import Pool, PoolMeta
@@ -147,8 +147,9 @@
             if Warning.check(warning_name):
                 raise PurchaseWarning(
                     warning_name,
-                    gettext(
+                    ngettext(
                         'production_outsourcing.msg_pending_purchase_draft',
+                        len(pendings),
                         productions=names))
         PurchaseLine.delete(to_delete)
 
@@ -175,8 +176,9 @@
             if Warning.check(warning_name):
                 raise PurchaseWarning(
                     warning_name,
-                    gettext(
+                    ngettext(
                         'production_outsourcing.msg_pending_purchase_cancel',
+                        len(pendings),
                         productions=names))
         PurchaseLine.delete(to_delete)
 
@@ -278,6 +280,8 @@
             if Warning.check(warning_name):
                 raise PurchaseWarning(
                     warning_name,
-                    gettext('production_outsourcing.msg_pending_purchase_done',
+                    ngettext(
+                        'production_outsourcing.msg_pending_purchase_done',
+                        len(productions),
                         productions=names))
         super().do(productions)

Reply via email to