I am making a module that shows area in square meters out of millimeters values,
I have a field that stores the area defined like this in the *.py file:
Code:
'area_mp': fields.float(string='Area in m^2', help="This is te area expressed in square meters.")
in the xml file I have this:
Code:
<field digits="(14, 3)" name="area_mp" attrs="{'readonly':[('type','=','service')]}"/>
But the problem is that the area_mp field will only show integer values. I need to show also values below 0. Eg. 0,56.
And second problem is that I have
on change functions for width and length that changes the value of area_mp
Code:
def onchange_length(self, cr, uid, ids, length, width, area_mp):
if length:
return {'value': {'area_mp': width*length/1000000}} #ver 1
self.write(cr, uid, ids, {'area_mp': width*length/1000000}) #ver2
return False
I want to use only one of them
ver1 works
ver 2 used to work but not anymore gives something about write concurrency. what could be wrong?
is there any other nice way to refresh a value in the form view?
Any help would be appreciated.
Thanks