On 2018-08-07 06:21, Javier Uribe wrote: > El martes, 7 de agosto de 2018, 13:40:05 (UTC+2), Cédric Krier escribió: > > On 2018-08-07 03:57, Javier Uribe wrote: > > > Ah ok, I think I understand now. So if the field function does not have a > > > on_change as a getter, for example, a field moves which has as a getter > > > get_moves(). This methos will not be trigger when creating a record, will > > > it? > > > > No, the getter are only called when reading records. > > > > > So I only have to care to trigger on_change and on_change with causing > > > that the fields function which has this on_change as getter will be > > > filled. > > > > > > My only doubt then is with these cases in which the field does not have > > > an on_change method as a getter, and during the process of creating a > > > record I want to use this field. Because if i'm not wrong, on Tryton if > > > i'm creating a record and I print moves (using the same example), this > > > will trigger get_moves. How does Tryton client get this value? > > > > The print action will save the record before being launched. > > > I see, therefore, I only have to call all the on_change and on_change_with > during the creation of a record, because these will call all the field > functions needed. The other fields.function which does not have on_change are > not to be invoked until they are not in a read record.
No, you must not call all the on_change's only those related to a field the user has changed. Implementing the full client stack is an heavy job, you may better use the web client which is responsive or make a tailored application which does not care about following the client protocol. > The only thing that I think it wouldn't work is the domain/states because > what if there is a domain/state which mentions an Eval(fieldFUnction), so I > have to have it on my context but I can't because I can't read a > field.function (which does not have an on change getter). So the states makes > my field invisible for example when creating a record. How do I put in my > context these fields? You must use its default value if there is one or its fallback value depending of the field (usually None but it is an empty list for One2Many etc.) -- Cédric Krier - B2CK SPRL Email/Jabber: [email protected] Tel: +32 472 54 46 59 Website: http://www.b2ck.com/ -- 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/20180807140357.3waii5o5gec4r3ca%40kei.
