From 8dea473c6985f81972ced6b2a55519fcd7e400b7 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 8 Jun 2012 18:31:55 +0530 Subject: [PATCH] fix in custom fields' get query function --- py/core/doctype/custom_field/custom_field.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/py/core/doctype/custom_field/custom_field.js b/py/core/doctype/custom_field/custom_field.js index 7d5c2d38f4..cafe84cdda 100644 --- a/py/core/doctype/custom_field/custom_field.js +++ b/py/core/doctype/custom_field/custom_field.js @@ -55,10 +55,15 @@ cur_frm.cscript.label = function(doc){ cur_frm.fields_dict['dt'].get_query = function(doc, dt, dn) { - return 'SELECT tabDocType.name FROM tabDocType WHERE IFNULL(tabDocType.issingle,0)=0 AND tabDocType.name LIKE "%s" ORDER BY name ASC LIMIT 50'; + return 'SELECT name FROM `tabDocType` \ + WHERE IFNULL(issingle,0)=0 AND \ + IFNULL(in_create, 0)=0 AND \ + (module IN ("Accounts", "Buying", "HR", "Knowledge Base", \ + "Production", "Projects", "Selling", "Stock", "Support") OR \ + name IN ("Contact", "Address")) AND \ + name LIKE "%s" ORDER BY name ASC LIMIT 50'; } - cur_frm.cscript.fieldtype = function(doc, dt, dn) { if(doc.fieldtype == 'Link') cur_frm.fields_dict['Options Help'].disp_area.innerHTML = 'Please enter name of the document you want this field to be linked to in Options.
Eg.: Customer'; else if(doc.fieldtype == 'Select') cur_frm.fields_dict['Options Help'].disp_area.innerHTML = 'Please enter values in Options separated by enter.
Eg.: Field: Country
Options:
China
India
United States

OR
You can also link it to existing Documents.
Eg.: link:Customer';