From 2de9342a11a286b2d1f9ac3af6f63c3a62ea419c Mon Sep 17 00:00:00 2001 From: "Touati Djamel (otd)" Date: Tue, 25 Jan 2022 15:14:47 +0000 Subject: [PATCH] [FIX] product: fix contained quantity decimal precision Steps to reproduce the bug: - Activate packaging in inventory configurations - set the product UOM digits to more than 2 decimals - Create a storable product: - Go to inventory tab > Packaging > Add a line - Change the contained quantity to a value with more than 2 decimal places Problem: It will round it to 2 decimal places regardless of the set digits. Because the formatFloat function does not receive the digits in parameter, so it uses 2 as default value Problem: opw-2723068 closes odoo/odoo#83411 X-original-commit: 144761f07c9de53aaeb7e1468e017eee17cbacd2 Signed-off-by: William Henrotin (whe) Signed-off-by: Djamel Touati (otd) --- addons/product/models/product.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/product/models/product.py b/addons/product/models/product.py index 42539e5ab51..0c7b2ba5612 100644 --- a/addons/product/models/product.py +++ b/addons/product/models/product.py @@ -748,7 +748,7 @@ class ProductPackaging(models.Model): name = fields.Char('Product Packaging', required=True) sequence = fields.Integer('Sequence', default=1, help="The first in the sequence is the default one.") product_id = fields.Many2one('product.product', string='Product', check_company=True) - qty = fields.Float('Contained Quantity', default=1, help="Quantity of products contained in the packaging.") + qty = fields.Float('Contained Quantity', default=1, digits='Product Unit of Measure', help="Quantity of products contained in the packaging.") barcode = fields.Char('Barcode', copy=False, help="Barcode used for packaging identification. Scan this packaging barcode from a transfer in the Barcode app to move all the contained units") product_uom_id = fields.Many2one('uom.uom', related='product_id.uom_id', readonly=True) company_id = fields.Many2one('res.company', 'Company', index=True)