Ok, so I solved my problem as I didn't want to remove the on_change attributes... There is a better and more stable way of working than using the api.onchange decorator for now. I guess the decorators could get more stable over time but in my case it didn't fit at all. It would get called and sometimes it wouldn't... Children of object do not have access to parent object because the ORM doesn't allow it... ask me why I don't know...
That said the holy grail is to override the onchange method on the object.
I noticed that whenever something happens, it would call the onchange method on my account.voucher object.
So the solution is to create a method:
def onchange(self, ids, values, field, fields):
result = super(AccountVoucher, self).onchange(
values, field, fields
# do whatever you want here change result and return it
This way, all changes are visible and it never miss. It also call other onchange when calling super so you don't miss anything. If you need to use decorators anyway, it shouldn't stop anything from working. In other words... while overriding onchange, you're getting at the root of the problem and nothing stops you from getting things done.
Asked in February 2016Viewed 3,536 timesVoted 13Answered 2 times