Hi am trying to understand something , i have a field type float and i want to display a sentence if i put “0” , it works with all numbers under 0 and after 0 but not with “0”
is it normal with tryton , is their a problem with using 0 with tryton
diameter = fields.Float("Diameter ")
@fields.depends('diameter', 'art')
def on_change_with_diameter_arts(self, name=None):
if (self.diameter == 0 and self.art == "carpentry" ):
return " No carpentry "
but nothing display when i put “0” in the field “diameter” , it doesn’t work just when i make “0” in field but in other conditions and with other number it works normally !
Something is not right with your on_change_with name function. Are you trying to have the field art display the value No carpentry based on the value of the diameter? If so then your on_change_with function should be named correctly to:
def on_change_with_art(self, name=None)
The naming convention for on_change_ and on_change_with_ is very critical for it to work.
Hi , No am trying to display in the field" ```
diameter_arts
" the value returned by the function on_change_with_diameter_arts ,
when i tried to work in debug mode like M. @ced advice me, there was an error shown for the first time :
float() argument must be a string or a number, not 'NoneType
I see, well, I guessed wrong.
In that case, depending on how and where your form is displayed, the NoneType problem maybe due to the lack of a default value for the field diameter. Have you tried putting a