From e37f0384f8048782e51c70cb7637aebc3b214eaf Mon Sep 17 00:00:00 2001 From: "P. Christeas" Date: Tue, 7 Dec 2010 15:36:57 +0200 Subject: [PATCH] sale: pack the warning message in one string (i18n), allow utf8 [Bug 684616] As reported by Jacara, str(type_ul.name) would bork with unicode. In addition, the concatenated string would be harder to translate. bzr revid: p_christ@hol.gr-20101207133657-7tk732027zuj9whs --- addons/sale/sale.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 29826e1c293..66d7c1ac56a 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -1053,11 +1053,14 @@ class sale_order_line(osv.osv): q = product_uom_obj._compute_qty(cr, uid, uom, pack.qty, default_uom) # qty = qty - qty % q + q if qty and (q and not (qty % q) == 0): - ean = pack.ean + ean = pack.ean or _('(n/a)') qty_pack = pack.qty type_ul = pack.ul - warn_msg = _("You selected a quantity of %d Units.\nBut it's not compatible with the selected packaging.\nHere is a proposition of quantities according to the packaging: ") % (qty) - warn_msg = warn_msg + "\n\n" + _("EAN: ") + str(ean) + _(" Quantity: ") + str(qty_pack) + _(" Type of ul: ") + str(type_ul.name) + warn_msg = _("You selected a quantity of %d Units.\n" + "But it's not compatible with the selected packaging.\n" + "Here is a proposition of quantities according to the packaging:\n\n" + "EAN: %s Quantity: %s Type of ul: %s") % \ + (qty, ean, qty_pack, type_ul.name) warning = { 'title': _('Picking Information !'), 'message': warn_msg