From 173c6b69dd020f20c0760df61d5942e31ea83482 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Mon, 6 Apr 2020 10:01:10 +0000 Subject: [PATCH] [FIX] sale_stock: product package - Activate "Product Packagings" in the Sales Settings - Define a package on a storable product with a contained Qty of 1.8 - Sell 5.4 units of this product in an SO and use the package. A warning is raised. This happens because 5.4 % 1.8 = 2.220446049250313e-16 opw-2228859 closes odoo/odoo#49070 X-original-commit: f1e79c74a5c07d6be3154629f6f381ebaf907fb1 Signed-off-by: Nicolas Martinelli (nim) --- addons/sale_stock/models/sale_order.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sale_stock/models/sale_order.py b/addons/sale_stock/models/sale_order.py index d5f385bdbf1..fe2de7e5abe 100644 --- a/addons/sale_stock/models/sale_order.py +++ b/addons/sale_stock/models/sale_order.py @@ -569,7 +569,7 @@ class SaleOrderLine(models.Model): pack = self.product_packaging qty = self.product_uom_qty q = default_uom._compute_quantity(pack.qty, self.product_uom) - if qty and q and (qty % q): + if qty and q and round(qty % q, 2): newqty = qty - (qty % q) + q return { 'warning': {