fetching data from last route (#10816)

This commit is contained in:
Zarrar 2017-09-18 15:11:20 +05:30 committed by Nabin Hait
parent 11bd5fc3b1
commit 8f957ef6e6

View File

@ -3,6 +3,15 @@
frappe.ui.form.on('Subscription', {
setup: function(frm) {
if(frm.doc.__islocal) {
var last_route = frappe.route_history.slice(-2, -1)[0];
if(frappe.dynamic_link && frappe.dynamic_link.doc
&& frappe.dynamic_link.doc.name==last_route[2]) {
frm.set_value('reference_doctype', last_route[1]);
frm.set_value('reference_document', last_route[2]);
}
}
frm.fields_dict['reference_document'].get_query = function() {
return {
filters: {