how to auto check check box by entering value in other field?
<p>I have made a module for hotel room management and I want to check room availability in Python. I have taken on checkbox named <code>available = fields.Boolean()</code>. Now, I want that it will be automatically checked when I enter check_in_time. so, how can I do this? I have taken 
<code>check_in_time=fields. Datetime()</code>. I have already tried like this...</p>

<pre class="lang-py prettyprint-override"><code>class Hotel_Management(models.Model):

    check_in_time = fields. Datetime()
    available = fields.Boolean()

    @api.onchange('check_in_time')
    def auto_check(self):
        for a in self:
            if a.check_in_time:
                a.available=True
                print a.available
            else:
                print a.available
</code></pre>

<p>But it changes the value of the checkbox only in the terminal....not in the database....it takes "false" value by default every time. So, tell me how to change the value of the checkbox in the database?</p>

<p>Your code is right. The value will be saved upon "Save" action in the client. <code>onchange</code> will save the value virtually at clientside. <code>depends</code> will instead write directly into database. But <code>onchange</code> should be enough here.</p>

python openerp