Selection field with if in Domain

41 visualizações
Pular para a primeira mensagem não lida

Daniela Barroso

não lida,
7 de mar. de 2016, 09:50:0407/03/2016
para tryton
Hi!

I need to make a selection field that must to change the options basead in an other selection field.
I tried to do with domain and If, but the selection doesn't load the options.

doador = fields.Selection([(None, ''),
('dv', 'Vivo'),
('df', 'Falecido')], 'Doador')
tipagem_hla = fields.Selection([(None, ''),
('idem', u'Idêntico'),
('haplo', u'Haploidentico'),
('dist', u'Distinto'),
('miss', u'Missmatches')],
u'Tipagem HLA',
domain=[(
If((Bool(Eval('doador') == 'dv')),
([('tipagem_hla', '=', None),
('tipagem_hla', '=', 'idem'),
('tipagem_hla', '=', 'haplo'),
('tipagem_hla', '=', 'dist')]),
([('tipagem_hla', '=', None),
('tipagem_hla', '=', 'idem'),
('tipagem_hla', '=', 'haplo'),
('tipagem_hla', '=', 'dist'),
('tipagem_hla', '=', 'miss')])))] )

Can anyone help me?


Cédric Krier

não lida,
8 de mar. de 2016, 10:30:0408/03/2016
para tryton
With your domains, there are no value ever possible.
The field tipagem_hla can not be None and 'idem' and 'haplo' and 'dist'
at the same time.
domain lists with no initial operator are 'AND'.
see: http://doc.tryton.org/3.8/trytond/doc/topics/domain.html


--
Cédric Krier - B2CK SPRL
Email/Jabber: cedric...@b2ck.com
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/
Responder a todos
Responder ao autor
Encaminhar
0 nova mensagem