El martes, 7 de agosto de 2018, 12:40:06 (UTC+2), Cédric Krier escribió: > On 2018-08-07 03:12, Javier Uribe wrote: > > El martes, 7 de agosto de 2018, 11:55:06 (UTC+2), Cédric Krier escribió: > > > On 2018-08-07 02:02, Javier Uribe wrote: > > > > El martes, 7 de agosto de 2018, 11:00:06 (UTC+2), Cédric Krier > > > > escribió: > > > > > On 2018-08-07 01:26, Javier Uribe wrote: > > > > > > So, lets say for instance that we have a field moves which is a > > > > > > Fields.function which has a method get_moves(). And I have just > > > > > > created a record that has this field, the fields_get tells me that > > > > > > it is a readonly. How should I fill the field moves with its value? > > > > > > > > > > Like any other field with the value read. > > > > > > > > So, can I read a field of a record that doesn't exist yet?, if that so, > > > > that's my problem I haven't seen how to do that. > > > > > > Of course, you can not read a record that does not exist. > > > I was answering about the creation like you said in your previous > > > message. > > > > > > But the default value of a readonly field is just like the default value > > > of any field. But you must not send the value of readonly field to the > > > server for creation. > > > > First of all, thanks a lot for your time but I still don't get how to do > > what I want. I want to read a field function of a record that doesn't exist > > because I'm creating, so basically when i'm creating a record and it is not > > saved on the server I only have the default values, but the function fields > > I understand that the must be filled as well. So what I want is to populate > > the model with the default values and the function fields. The > > default_values can be read easily using the RPC method default_get, however > > the function fields cannot be read from a record that does not exist. > > As I already said. There is nothing special about Function field on the > client side because client side does not know anything about Function > field and should never know anything about it. > So default value for function field are just like any default value of > any kind of field. > > Now maybe, you would like to have the field (function or not) been > updated when the user fill the form. This is managed by the on_change > methods: > https://tryton-readthedocs.readthedocs.io/projects/server/en/latest/topics/models/fields_on_change.html > And again, client does not care about Function field or not also for the > on_change feature. > > > > PS: Could you trim your quotes when answering, especially signature, > thanks. 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? 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? -- 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/20c4e83d-d643-4e2d-acf3-5a8ba2501119%40googlegroups.com.
