diff --git a/addons/stock/models/stock_inventory.py b/addons/stock/models/stock_inventory.py index a3a16bdf895..c3ffeb152de 100644 --- a/addons/stock/models/stock_inventory.py +++ b/addons/stock/models/stock_inventory.py @@ -274,11 +274,11 @@ class InventoryLine(models.Model): theoretical_qty = self.env["product.uom"]._compute_qty_obj(self.product_id.uom_id, theoretical_qty, self.product_uom_id) self.theoretical_qty = theoretical_qty - @api.onchange('product_id', 'product_uom_id') - def onchange_product_or_uom(self): + @api.onchange('product_id') + def onchange_product(self): res = {} # If no UoM or incorrect UoM put default one from product - if self.product_id and (not self.product_uom_id or self.product_id.uom_id.category_id != self.product_uom_id.category_id): + if self.product_id: self.product_uom_id = self.product_id.uom_id res['domain'] = {'product_uom_id': [('category_id', '=', self.product_id.uom_id.category_id.id)]} return res