diff --git a/modules/production_outsourcing/message.xml b/modules/production_outsourcing/message.xml index f625a8f9da..de51cb8c33 100644 --- a/modules/production_outsourcing/message.xml +++ b/modules/production_outsourcing/message.xml @@ -4,13 +4,16 @@ this repository contains the full copyright notices and license terms. --> - The productions "%(productions)s" cannot be reset to draft as they have pending purchases. + The production "%(productions)s" cannot be reset to draft as it has pending purchases. + The productions "%(productions)s" cannot be reset to draft as they have pending purchases. - The productions "%(productions)s" cannot be cancelled as they have pending purchases. + The production "%(productions)s" cannot be cancelled as it has pending purchases. + The productions "%(productions)s" cannot be cancelled as they have pending purchases. - The productions "%(productions)s" cannot be processed as they have pending purchases. + The production "%(productions)s" cannot be processed as it has pending purchases. + The productions "%(productions)s" cannot be processed as they have pending purchases. diff --git a/modules/production_outsourcing/production.py b/modules/production_outsourcing/production.py index a8f837f7b3..4bdb9975b3 100644 --- a/modules/production_outsourcing/production.py +++ b/modules/production_outsourcing/production.py @@ -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 @@ class Production(metaclass=PoolMeta): 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 @@ class Production(metaclass=PoolMeta): 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 @@ class Production(metaclass=PoolMeta): 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)