Le 02/06/2015 09:16, Sergi Almacellas Abellana a écrit :
El 02/06/15 a les 09:12, Christophe (net) ha escrit:
Le 02/06/2015 09:08, Jean C a écrit :
2015-06-02 9:01 GMT+02:00 Christophe (net) <[email protected]
<mailto:[email protected]>>:
I try to update a value in a one2many through the on_change_*
method.
I saw that it was possible to use the form:
{O2M: {'update': [{field: value, ...}]}}
but the latter does not update the records currently displayed in
the client and it is not possible to achieve in particular
recording.
Is there a better way?
Since the 3.4 version (I think), you do not have to return anything in
on_change methods (NOT true
for on_change_with methods). Juste update the values of your field, and
reset it to make sure it
is detected as modified :
def on_change_...(self):
self.lines[0].name = 'some new name'
# Force modification detection
self.lines = self.lines
That's all !
Thank, but sorry i forgotten to precise, I'm on 3.0
You have to return the id in the dict values in order to the client know
which record you want to update. So it will be:
{O2M: {'update': [{'id': record_id, field: value, ...}]}}
Hope it helps!
It'works ! thanks.
--
Christophe