El 29/03/18 a les 09:19, Khurram Shahzad ha escrit: > Dear All, > > I have defined a model class with some attributes, methods for setting > default values and on_change() event listener. How can I instantiate it > so that I can have its attributes initialized automatically by > default_??? methods and when user make some change to fields, the > on_change() event gets fired.
When you instantiate a model from code default values and on_change are not applied. This is done on client side. > > In fact, I will show a list of such objects to user and when user is > done with entering data, and save them when he clicks 'Process' button > of wizard. What is the user behavior here? It has to create the records or it has to update some data? Best way is to show a One2Many field on the wizard. If the user has to create the records just leave it empty an let them fill the records. If you have to modify some existing records, just return the ids of the records as default value and the client will show the record with all the values of the view. In both cases the client will automatically call the defaults and on_change required for user actions. Hope it helps. -- Sergi Almacellas Abellana www.koolpi.com Twitter: @pokoli_srk -- 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/80c05141-04b5-7fba-9f1e-c976a9729054%40koolpi.com.