[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
This commit is contained in:
Nicolas Martinelli
2016-12-02 11:10:19 +01:00
parent 3344cce465
commit a894fb33c1
+7
View File
@@ -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