Use ngettext for warning message about pending purchases of outsourced productions
This commit is contained in:
@@ -4,13 +4,16 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<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>
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user