[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) <nim@odoo.com>
This commit is contained in:
Nicolas Martinelli
2020-04-06 13:51:10 +00:00
parent 844a4cb49b
commit 173c6b69dd
+1 -1
View File
@@ -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': {