From a894fb33c12909fb25df0fc93fbe0a7c235b6f4f Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Fri, 2 Dec 2016 11:07:49 +0100 Subject: [PATCH] [FIX] product: bigger ratio - Create a new unit of measure with 'Bigger than the reference Unit of Measure' - Save - Edit and change the ratio ==> the ratio is set back to its value opw-695507 --- addons/product/models/product_uom.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/addons/product/models/product_uom.py b/addons/product/models/product_uom.py index 6a3a0414778..9c3baa4d6db 100644 --- a/addons/product/models/product_uom.py +++ b/addons/product/models/product_uom.py @@ -61,6 +61,13 @@ class ProductUoM(models.Model): values['factor'] = factor_inv and (1.0 / factor_inv) or 0.0 return super(ProductUoM, self).create(values) + @api.multi + def write(self, values): + if 'factor_inv' in values: + factor_inv = values.pop('factor_inv') + values['factor'] = factor_inv and (1.0 / factor_inv) or 0.0 + return super(ProductUoM, self).write(values) + @api.model def name_create(self, name): """ The UoM category and factor are required, so we'll have to add temporary values