Set a default value for factor when creating a new uom.
Could not create a new UoM with type reference (if creates a reference uom, no need to pass a factor).
Change the readonly filter to (type = bigger) to make the field writable for reference uom.
This is needed to force the reset of the factor when switching of type (onchange_type).
As the field was readonly, kept the old value for factor.
_defaults = {
'active': 1,
'rounding': 0.01,
+ 'factor': 1,
'uom_type': 'reference',
}
<field name="factor"
digits="[42,5]"
attrs="{'invisible':[('uom_type','!=','smaller')],
- 'readonly':[('uom_type','!=','smaller')]}"/>
+ 'readonly':[('uom_type','=','bigger')]}"/>
<field name="factor_inv"
digits="[42,5]"
attrs="{'invisible':[('uom_type','!=','bigger')],