El martes, 2 de junio de 2015, 1:16:21 (UTC-6), Sergi Almacellas Abellana escribió: > 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! > -- > Sergi Almacellas Abellana > www.koolpi.com > Twitter: @pokoli_srk
Could you give a complete example? -- You received this message because you are subscribed to the Google Groups "tryton" group. To view this discussion on the web visit https://groups.google.com/d/msgid/tryton/4dd638ea-aa62-4346-8469-46f99a4ebda2%40googlegroups.com.
