Dear Sergi, Thanks for the response.
On Thu, Mar 29, 2018 at 2:30 PM, Sergi Almacellas Abellana <se...@koolpi.com > wrote: > 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? > In fact, we are working on duty roster management. I run a wizard, which shows list of employees and months. The user selects a month and an employee. When employee changes, I fill a One2Many field which contains as many records as days. Here I want default values for every day, like default shift. I also want that when user changes a shift for a day, its time is displayed in next column. > > 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. > I am doing the same; but I can not leave the records empty. Moreover, I also want to respond to change events of each record. > > In both cases the client will automatically call the defaults and > on_change required for user actions. > > Hope it helps. > > Thanks again. Regards, Khurram. -- 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/CAM3N3CwMfJVrRurw6JTtUv7iFVxMGeFL34UNPHb_igFcFMQz2A%40mail.gmail.com.