diff --git a/frappe/database.py b/frappe/database.py index c245f415bc..c2db226d5d 100644 --- a/frappe/database.py +++ b/frappe/database.py @@ -344,7 +344,7 @@ class Database: _rhs = " ({0})".format(", ".join(inner_list)) del values[key] - if _operator not in ["=", "!=", ">", ">=", "<", "<=", "like", "in", "not in"]: + if _operator not in ["=", "!=", ">", ">=", "<", "<=", "like", "in", "not in", "not like"]: _operator = "=" if "[" in key: diff --git a/frappe/model/db_query.py b/frappe/model/db_query.py index 6aceeac6d5..93f42fcb1d 100644 --- a/frappe/model/db_query.py +++ b/frappe/model/db_query.py @@ -248,7 +248,7 @@ class DatabaseQuery(object): value = get_time(f.value).strftime("%H:%M:%S.%f") fallback = "'00:00:00'" - elif f.operator == "like" or (isinstance(f.value, basestring) and + elif f.operator in ("like", "not like") or (isinstance(f.value, basestring) and (not df or df.fieldtype not in ["Float", "Int", "Currency", "Percent", "Check"])): value = "" if f.value==None else f.value fallback = '""' diff --git a/frappe/public/js/frappe/ui/filters/edit_filter.html b/frappe/public/js/frappe/ui/filters/edit_filter.html index 4991115c7f..842da09776 100644 --- a/frappe/public/js/frappe/ui/filters/edit_filter.html +++ b/frappe/public/js/frappe/ui/filters/edit_filter.html @@ -8,6 +8,7 @@ + diff --git a/frappe/public/js/frappe/ui/filters/filters.js b/frappe/public/js/frappe/ui/filters/filters.js index 9cf7a2fa30..eb52d86ec2 100644 --- a/frappe/public/js/frappe/ui/filters/filters.js +++ b/frappe/public/js/frappe/ui/filters/filters.js @@ -150,7 +150,7 @@ frappe.ui.Filter = Class.extend({ // add help for "in" codition me.$w.find('.condition').change(function() { var condition = $(this).val(); - if(in_list(["in", "like", "not in"], condition)) { + if(in_list(["in", "like", "not in", "not like"], condition)) { me.set_field(me.field.df.parent, me.field.df.fieldname, 'Data', condition); if(!me.field.desc_area) { me.field.desc_area = $('
').appendTo(me.field.wrapper); @@ -210,12 +210,12 @@ frappe.ui.Filter = Class.extend({ } var df = copy_dict(me.fieldselect.fields_by_name[doctype][fieldname]); - + // all fields shown in filters if(df.hidden) { df.hidden = 0; } - + this.set_fieldtype(df, fieldtype); // called when condition is changed, @@ -317,7 +317,7 @@ frappe.ui.Filter = Class.extend({ val = (val=='Yes' ? 1 :0); } - if(this.get_condition()==='like') { + if(this.get_condition().indexOf('like', 'not like')!==-1) { // automatically append wildcards if(val) { if(val.slice(0,1) !== "%") {