From edc1cbc063535fa69a526dc3d069dca76daadd63 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Tue, 4 Dec 2018 10:33:31 +0000 Subject: [PATCH] [FIX] stock: To prevent settig a wrong uom Steps to reproduce the bug: - Configure to use UoM - Make an inventory adjustment for all product - Select one product one the inventory line, and select the UoM Bug: All the UoMs were selectable but only the uoms in the same category of the product are allowed. opw:1911941 closes odoo/odoo#29238 --- addons/stock/models/stock_inventory.py | 1 + addons/stock/views/stock_inventory_views.xml | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/stock/models/stock_inventory.py b/addons/stock/models/stock_inventory.py index c63288d8b60..682fb083da1 100644 --- a/addons/stock/models/stock_inventory.py +++ b/addons/stock/models/stock_inventory.py @@ -333,6 +333,7 @@ class InventoryLine(models.Model): 'uom.uom', 'Product Unit of Measure', required=True, default=lambda self: self.env.ref('uom.product_uom_unit', raise_if_not_found=True)) + product_uom_category_id = fields.Many2one(string='Uom category', related='product_uom_id.category_id', readonly=True) product_qty = fields.Float( 'Checked Quantity', digits=dp.get_precision('Product Unit of Measure'), default=0) diff --git a/addons/stock/views/stock_inventory_views.xml b/addons/stock/views/stock_inventory_views.xml index f6c60243c22..0aef58e898c 100644 --- a/addons/stock/views/stock_inventory_views.xml +++ b/addons/stock/views/stock_inventory_views.xml @@ -164,7 +164,8 @@ - + +