El miércoles, 26 de febrero de 2014 14:08:18 UTC+1, Sergi Almacellas Abellana escribió: > > El 26/02/14 13:51, Jesús Martín Jiménez ha escrit: > > Hi, > > > > I need to set dinamically the selection values of functional field of > > type selection. Something like that: > > > > selection = fields.Function(fields.Selection('get_selection', > 'Value', > > states={ > > 'invisible': Eval('field_type') != 'selection', > > }, depends=['field_type'], on_change_with=['model', > > 'field']), > > 'on_change_with_selection', setter='set_value') > > > > @staticmethod > > def get_selection(): > > .... > > > > def on_change_with_selection(self, ...): > > .... > > > > But it seems that is not possible to mix this kind of methods in these > > type of fields because get_selection is an RCP method not allowed. Is > > it possible to do this? And in affirmative case, how? > > > You must manually add get_selection to model RPC. You can find an > example on: > > http://hg.tryton.org/modules/account/file/8edd6f64d461/move.py#l563 >
Thanks Sergi. Your answer works fine, but it is not what I need. My mistake is my poor explanation. I have a field related to the model ir.model.field, and when I select in this field a field of type selection, I have to get the possible values of that field to compute the selection values of this field. I mean, I need to set dinamically the selection values of the selection field related to the instance, not with the model (class) itself. Is it possible? Thanks again. > > > Thanks, > > > -- > Sergi Almacellas Abellana > www.koolpi.com > Twitter: @pokoli_srk > >