fix: reduce code complexity

This commit is contained in:
prssanna 2020-07-22 14:53:03 +05:30
parent 1d9903bfdd
commit 95aa4a72dc
2 changed files with 6 additions and 5 deletions

View file

@ -249,9 +249,7 @@ frappe.ui.Filter = class {
let args = {};
if (this.filters_config[condition].depends_on) {
const field_name = this.filters_config[condition].depends_on;
const filter_value = this.base_list
? this.base_list.get_filter_value(field_name)
: this.filter_list.get_filter_value(field_name);
const filter_value = this.get_filter_value(field_name);
args[field_name] = filter_value;
}
frappe
@ -267,6 +265,10 @@ frappe.ui.Filter = class {
}
}
get_filter_value(fieldname) {
return this.filter_list.get_filter_value(fieldname);
}
make_field(df, old_fieldtype) {
let old_text = this.field ? this.field.get_value() : null;
this.hide_invalid_conditions(df.fieldtype, df.original_type);

View file

@ -104,8 +104,7 @@ frappe.ui.FilterGroup = class {
filter_items: (doctype, fieldname) => {
return !this.filter_exists([doctype, fieldname]);
},
base_list: this.base_list,
filter_list: this,
filter_list: this.base_list || this,
};
let filter = new frappe.ui.Filter(args);
this.filters.push(filter);