On 23/08/13 05:52 -0700, igomes wrote:
> How can I do for a field became dependent on two other fields?
> 
> I want that the realtor_type field be required only if active and realtor 
> are checked.
> 
> I did this, but it didn't work.
> 
> STATES_REALTOR = {
>     'readonly': ~Eval('active', True),
>     'readonly': ~Eval('realtor', True),
> }

Such construction will make the second similar key erase the first one.
You must use an "AND":

    STATES_REALTOR = {
        'required': Eval('active', True) & Eval('realtor', True),
        }

> DEPENDS_REALTOR = ['active', 'realtor']
> 
>     realtor_type = fields.Selection([
>         ("1", "xxx"),
>         ("2", "yyy"),
>         (None, '')],
>         'Realtor Type',
>         required=False,
>         states=STATES_REALTOR, depends=DEPENDS_REALTOR)

-- 
Cédric Krier

B2CK SPRL
Rue de Rotterdam, 4
4000 Liège
Belgium
Tel: +32 472 54 46 59
Email/Jabber: [email protected]
Website: http://www.b2ck.com/

Attachment: pgpsqOQbrmsYh.pgp
Description: PGP signature

Reply via email to