python - how to auto check check box by entering value in other field? -


i have made module hotel room management , want check room availability in python. have taken on checkbox named available = fields.boolean(). now, want automatically checked when enter check_in_time. so, how can this? have taken check_in_time=fields. datetime(). have tried this...

class hotel_management(models.model):      check_in_time = fields. datetime()     available = fields.boolean()      @api.onchange('check_in_time')     def auto_check(self):         in self:             if a.check_in_time:                 a.available=true                 print a.available             else:                 print a.available 

but changes value of checkbox in terminal....not in database....it takes "false" value default every time. so, tell me how change value of checkbox in database?

your code right. value saved upon "save" action in client. onchange save value virtually @ clientside. depends instead write directly database. onchange should enough here.


Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -