[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) <whe@odoo.com>
Signed-off-by: Djamel Touati (otd) <otd@odoo.com>
This commit is contained in:
Touati Djamel (otd)
2022-01-26 14:09:02 +00:00
parent 923c015267
commit 2de9342a11
+1 -1
View File
@@ -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)