It is currently Sun Feb 12, 2012 6:55 pm

All times are UTC + 2 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: make field required according to selection
PostPosted: Mon Mar 08, 2010 4:31 pm 
Offline

Joined: Sun Mar 07, 2010 10:48 am
Posts: 22
Hello,

I have a form that have type drop down has (care-service) values and product list, i want when select service type the product must be required.

i did:

xml:
attrs="{'required':[('ticket_type','=','service')]}"
.py:
'ticket_type' : fields.related('tickettype_id','type',type='char',string='Type'),

when i select type service it save the record without ask me to enter product value.

Is attrs works only in tree view? if yes, how can i do it in form view.


Thanks in Advance


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 10, 2010 8:36 am 
Offline

Joined: Tue May 05, 2009 8:54 am
Posts: 15
Hi neveen,
Yes you can put attrs in form view.
I believe tickettype_id is selection field.
Try below code :

Quote:
in .py :
'ticket_type' : fields.related('tickettype_id','type',type='char',string='Type'),

in xml :
attrs="{'required':[('tickettype_id','=','service')]}"



If it doesn't work for you can you please elaborate, what you are getting in 'type' defined in your field?
Hope you got your solution

Thanks
SSI


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 2 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:

Protected by Anti-Spam ACP