Link Felds filter

In a doctype there is two link Fields User1 and User2 both link with ‘User’ if in field1 select a user then same can not select in field2.

I don’t remember the exact syntax but it must be like:

frm.set_query('user2', {'name': ['!=', user1.name]});

Look for set_query and get_query in the forum.
PS: I am thinking about erpsnippets.logedo.com just for these kind of problems. Would you interested in such a place where each contributor freely add their scripts so you can search around it?