Community mailing list archives

Re: Question on new API: @api.onchange and create()

Alexis de Lattre
- 12/14/2014 08:55:18
Le 14/12/2014 12:18, Alexis de Lattre a écrit :
<blockquote cite="" type="cite"> Do you mean that I should:
1) call create:
self.env['donation.line'].create({'product_id': 42})
2) then execute product_id_change, that will trigger a write on the donation line ?

I confirm that it works well. So, with the old API, we used to call the on_change method(s) BEFORE create(vals) to generate vals ; with the new API, we are supposed to call the on_change method(s) AFTER create(), and it will write on the new record.

Thanks for your help. I'm getting closer to an update of all the donation modules to the new API.