Merge pull request #3585 from mbauskar/filters-fixes
[fixes] fixes in standard filters
This commit is contained in:
commit
ed7dad8999
3 changed files with 20 additions and 5 deletions
|
|
@ -497,8 +497,10 @@ frappe.views.ListView = frappe.ui.BaseList.extend({
|
|||
}
|
||||
}
|
||||
|
||||
this.list_header.find('.list-liked-by-me')
|
||||
.toggleClass('text-extra-muted not-liked', !this.is_star_filtered());
|
||||
if(this.list_header) {
|
||||
this.list_header.find('.list-liked-by-me')
|
||||
.toggleClass('text-extra-muted not-liked', !this.is_star_filtered());
|
||||
}
|
||||
|
||||
this.last_updated_on = new Date();
|
||||
this.dirty = false;
|
||||
|
|
|
|||
|
|
@ -189,16 +189,25 @@ frappe.ui.BaseList = Class.extend({
|
|||
options:this.doctype,
|
||||
label:'ID',
|
||||
fieldname:'name',
|
||||
onchange: () => { me.refresh(true); }
|
||||
});
|
||||
|
||||
var has_standard_filters = false;
|
||||
this.meta.fields.forEach(function(df) {
|
||||
if(df.in_standard_filter) {
|
||||
if(df.fieldtype == "Select") {
|
||||
var options = df.options.split("\n")
|
||||
if(options.length > 0 && options[0] != ""){
|
||||
options.unshift("");
|
||||
df.options = options.join("\n");
|
||||
}
|
||||
}
|
||||
me.page.add_field({
|
||||
fieldtype: df.fieldtype,
|
||||
label: __(df.label),
|
||||
options: df.options,
|
||||
fieldname: df.fieldname
|
||||
fieldname: df.fieldname,
|
||||
onchange: () => {me.refresh(true);}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -260,7 +260,7 @@ frappe.views.ReportView = frappe.ui.BaseList.extend({
|
|||
// build args for query
|
||||
get_args: function() {
|
||||
let me = this;
|
||||
let filters = this.filter_list.get_filters();
|
||||
let filters = this.filter_list? this.filter_list.get_filters(): [];
|
||||
|
||||
return {
|
||||
doctype: this.doctype,
|
||||
|
|
@ -284,7 +284,7 @@ frappe.views.ReportView = frappe.ui.BaseList.extend({
|
|||
}
|
||||
|
||||
// second
|
||||
if(this.sort_by_next_select.val()) {
|
||||
if(this.sort_by_next_select && this.sort_by_next_select.val()) {
|
||||
order_by.push(this.get_selected_table_and_column(this.sort_by_next_select)
|
||||
+ ' ' + this.sort_order_next_select.val());
|
||||
}
|
||||
|
|
@ -293,6 +293,10 @@ frappe.views.ReportView = frappe.ui.BaseList.extend({
|
|||
},
|
||||
|
||||
get_selected_table_and_column: function(select) {
|
||||
if(!select) {
|
||||
return
|
||||
}
|
||||
|
||||
return select.selected_doctype ?
|
||||
this.get_full_column_name([select.selected_fieldname, select.selected_doctype]) : "";
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue