Selection field with if in Domain

41 views
Skip to first unread message

Daniela Barroso

unread,
Mar 7, 2016, 9:50:04 AM3/7/16
to 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

unread,
Mar 8, 2016, 10:30:04 AM3/8/16
to 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/
Reply all
Reply to author
Forward
0 new messages