Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Onchange in Odoo9

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 612
    Comment on it

    Onchange is the most important function for Odoo. The "onchange" mechanism provides a method for the client interface to update a form at the time when the user filled a value in a field, without saving anything to the database.
    For example you can see below code.
    content of form view

    <field name="amount">
    <field name="unit_price">
    <field name="price" readonly="1">
    # onchange handler
    @api.onchange('amount', 'unit_price')
    def _onchange_price(self):
        # set auto-changing field
        self.price = self.amount * self.unit_price
        # Can optionally return a warning and domains
        return {
            'warning': {
                'title': "Something bad happened",
                'message': "It was very bad indeed",
            }
        }</field></field></field>
    

    Note-An explicit onchange warn about invalid values, like a negative number of seats, or more participants than seats.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: