Merge branch 'hotfix'
This commit is contained in:
commit
1ef70343b4
2 changed files with 23 additions and 14 deletions
|
|
@ -14,7 +14,7 @@ import os, sys, importlib, inspect, json
|
|||
from .exceptions import *
|
||||
from .utils.jinja import get_jenv, get_template, render_template
|
||||
|
||||
__version__ = '8.2.5'
|
||||
__version__ = '8.2.6'
|
||||
__title__ = "Frappe Framework"
|
||||
|
||||
local = Local()
|
||||
|
|
|
|||
|
|
@ -184,30 +184,37 @@ frappe.ui.BaseList = Class.extend({
|
|||
return;
|
||||
}
|
||||
|
||||
if(this.meta) {
|
||||
if (this.meta) {
|
||||
this.page.add_field({
|
||||
fieldtype:'Link',
|
||||
options:this.doctype,
|
||||
label:'ID',
|
||||
fieldname:'name',
|
||||
fieldtype: 'Data',
|
||||
label: 'ID',
|
||||
condition: 'like',
|
||||
fieldname: 'name',
|
||||
onchange: () => { me.refresh(true); }
|
||||
});
|
||||
|
||||
this.meta.fields.forEach(function(df) {
|
||||
if(df.in_standard_filter && !frappe.model.no_value_type.includes(df.fieldtype)) {
|
||||
let options = df.options;
|
||||
let condition = '=';
|
||||
let fieldtype = df.fieldtype;
|
||||
if (['Link', 'Text', 'Small Text', 'Text Editor', 'Data'].includes(fieldtype)) {
|
||||
fieldtype = 'Data',
|
||||
condition = 'like'
|
||||
}
|
||||
if(df.fieldtype == "Select" && df.options) {
|
||||
options = df.options.split("\n")
|
||||
if(options.length > 0 && options[0] != ""){
|
||||
options = df.options.split("\n");
|
||||
if(options.length > 0 && options[0] != "") {
|
||||
options.unshift("");
|
||||
df.options = options.join("\n");
|
||||
options = options.join("\n");
|
||||
}
|
||||
}
|
||||
me.page.add_field({
|
||||
fieldtype: df.fieldtype,
|
||||
fieldtype: fieldtype,
|
||||
label: __(df.label),
|
||||
options: df.options,
|
||||
options: options,
|
||||
fieldname: df.fieldname,
|
||||
condition: condition,
|
||||
onchange: () => {me.refresh(true);}
|
||||
});
|
||||
}
|
||||
|
|
@ -228,13 +235,15 @@ frappe.ui.BaseList = Class.extend({
|
|||
let field = this.page.fields_dict[key];
|
||||
let value = field.get_value();
|
||||
if (value) {
|
||||
if (field.df.condition==='like' && !value.includes('%')) {
|
||||
value = '%' + value + '%';
|
||||
}
|
||||
filters.push([
|
||||
me.doctype,
|
||||
field.df.fieldname,
|
||||
(['Data', 'Text', 'Small Text', 'Text Editor']
|
||||
.includes(field.df.fieldtype) ? 'like' : '='),
|
||||
field.df.condition || '=',
|
||||
value
|
||||
])
|
||||
]);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue