Odoo Help

1

Revert @api.onchange or access original value

By
sharon shen
on 9/9/16, 12:40 PM 821 views

How do we revert the value of the parameter changed by @api.onchange. Or get the original value back.

I'm on odoo Version 9.

Ex: 

@api.onchange('carrier_id')

def on_carrier_changed(self):

    if something:

        # give some warning & do some logic

        # revert back carrier_id

Thanks!

0
sharon shen
On 12/16/16, 2:43 PM

Hi no i didn’t find an answer to that question, but my coworker suggested to change the way I do things to eliminate needing to go into onchange: Doing validation in other area, using domain filter to filter out values I don’t want…etc


Update:

old values are in self._origin. Self only contains new values. Even self.id = openerp.models.NewId

0
Peter Schwarz
On 12/16/16, 8:54 AM

I'm too new to this forum to post a commentary so please forgive me my 'answer'.

Have you found any solution? I am searching for about an hour now and I cannot find any way how to solve it!

Thank you!

old values are in self._origin. Self only contains new values. Even self.id = openerp.models.NewId

sharon shen
on 2/27/17, 4:46 PM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 9/9/16, 12:40 PM
Seen: 821 times
Last updated: 2/27/17, 4:48 PM