[fix] link broken in quick entry and filter setting in list view

This commit is contained in:
Rushabh Mehta 2017-07-07 19:05:44 +05:30
parent 9896b04f59
commit 258ec9a5f9
4 changed files with 19 additions and 12 deletions

View file

@ -1351,11 +1351,7 @@ frappe.ui.form.ControlLink = frappe.ui.form.ControlData.extend({
frappe._from_link_scrollY = $(document).scrollTop();
frappe.ui.form.make_quick_entry(doctype, (doc) => {
if(me.frm) {
me.parse_validate_and_set_in_model(doc.name);
} else {
me.set_value(doc.name);
}
return me.set_value(doc.name);
});
return false;
@ -1590,7 +1586,7 @@ frappe.ui.form.ControlLink = frappe.ui.form.ControlData.extend({
validate: function(value) {
// validate the value just entered
if(this.df.options=="[Select]" || this.df.ignore_link_validation) {
return;
return value;
}
return this.validate_link_and_fetch(this.df, this.get_options(),

View file

@ -138,7 +138,7 @@ frappe.ui.form.QuickEntryForm = Class.extend({
frappe.model.clear_doc(me.dialog.doc.doctype, me.dialog.doc.name);
me.dialog.doc = r.message;
if(frappe._from_link) {
frappe.ui.form.update_calling_link(me.dialog.doc.name);
frappe.ui.form.update_calling_link(me.dialog.doc);
} else {
if(me.after_insert) {
me.after_insert(me.dialig.doc);

View file

@ -289,7 +289,11 @@ frappe.ui.BaseList = Class.extend({
frappe.route_options = null;
},
run: function (more) {
run: function(more) {
setTimeout(() => this._run(more), 100);
},
_run: function (more) {
var me = this;
if (!more) {
this.start = 0;

View file

@ -50,6 +50,11 @@ frappe.ui.FilterList = Class.extend({
clear_filters: function() {
$.each(this.filters, function(i, f) { f.remove(true); });
if(this.base_list.page.fields_dict) {
$.each(this.base_list.page.fields_dict, (key, value) => {
value.set_input('');
});
}
this.filters = [];
},
@ -224,7 +229,7 @@ frappe.ui.Filter = Class.extend({
// set the field
if(me.fieldname) {
// pre-sets given (could be via tags!)
this.set_values(me._doctype, me.fieldname, me.condition, me.value);
return this.set_values(me._doctype, me.fieldname, me.condition, me.value);
} else {
me.set_field(me.doctype, 'name');
}
@ -255,7 +260,7 @@ frappe.ui.Filter = Class.extend({
this.wrapper.find('.condition').val(condition).change();
}
if(value!=null) {
this.field.set_value(value);
return this.field.set_value(value);
}
},
@ -310,8 +315,9 @@ frappe.ui.Filter = Class.extend({
f.refresh();
me.field = f;
if(old_text && me.field.df.fieldtype===cur.fieldtype)
me.field.set_input(old_text);
if(old_text && me.field.df.fieldtype===cur.fieldtype) {
me.field.set_value(old_text);
}
// run on enter
$(me.field.wrapper).find(':input').keydown(function(ev) {
@ -329,6 +335,7 @@ frappe.ui.Filter = Class.extend({
df.original_type = df.fieldtype;
df.description = ''; df.reqd = 0;
df.ignore_link_validation = true;
// given
if(fieldtype) {