Merge pull request #1392 from rmehta/not-like
[enhancement] added **not like** in filter options
This commit is contained in:
commit
32def8f303
4 changed files with 7 additions and 6 deletions
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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 = '""'
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
<option value="in">{%= __("In") %}</option>
|
||||
<option value="not in">{%= __("Not In") %}</option>
|
||||
<option value="!=">{%= __("Not Equals") %}</option>
|
||||
<option value="not like">{%= __("Not Like") %}</option>
|
||||
<option value=">">{%= __(">") %}</option>
|
||||
<option value="<">{%= __("<") %}</option>
|
||||
<option value=">=">{%= __(">=") %}</option>
|
||||
|
|
|
|||
|
|
@ -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 = $('<div class="text-muted small">').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) !== "%") {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue