Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to use api.onchange in Odoo ?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 223
    Comment on it

    All the work and tasks are done in the cache in on_change context. Therefore so you dont need to be worried for altering database as the recordSet will be able to altred inside your function. Thats the main difference with @api.depends.
    For example you can see below code.

    @api.onchange('fieldx')
    def do_stuff(self):
       if self.fieldx == x:
          self.fieldy = 'toto'

    Note- function return, differences between the cache and the RecordSet will be returned to the form.

 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: