From 12605be0d928a4c949cae8ff0a040a89e2685f02 Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Thu, 14 May 2009 15:57:20 +0530 Subject: [PATCH] [FIX] Bug 372290 : Float division error on packaging bzr revid: jvo@tinyerp.com-20090514102720-hw4pone7tr91s42b --- addons/sale/sale.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/sale/sale.py b/addons/sale/sale.py index cd1f8ab26ce..b853ecd0b35 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -880,12 +880,12 @@ class sale_order_line(osv.osv): pack = self.pool.get('product.packaging').browse(cr, uid, packaging, context) q = product_uom_obj._compute_qty(cr, uid, uom, pack.qty, default_uom) # qty = qty - qty % q + q - if qty and (not (qty % q) == 0): + if qty and (q and not (qty % q) == 0): ean = pack.ean 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\nEAN: " + str(ean) + " Quantiny: " + str(qty_pack) + " Type of ul: " + str(type_ul.name) + warn_msg = warn_msg + "\n\nEAN: " + str(ean) + " Quantity: " + str(qty_pack) + " Type of ul: " + str(type_ul.name) warning={ 'title':'Packing Information !', 'message': warn_msg