Merge pull request #6926 from nabinhait/hotfix

Multiple fixes
diff --git a/erpnext/accounts/doctype/payment_entry_reference/payment_entry_reference.json b/erpnext/accounts/doctype/payment_entry_reference/payment_entry_reference.json
index 968ce29..437d695 100644
--- a/erpnext/accounts/doctype/payment_entry_reference/payment_entry_reference.json
+++ b/erpnext/accounts/doctype/payment_entry_reference/payment_entry_reference.json
@@ -31,6 +31,7 @@
    "print_hide": 0, 
    "print_hide_if_no_value": 0, 
    "read_only": 0, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 1, 
    "search_index": 0, 
@@ -58,6 +59,7 @@
    "print_hide": 0, 
    "print_hide_if_no_value": 0, 
    "read_only": 0, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 1, 
    "search_index": 0, 
@@ -84,6 +86,7 @@
    "print_hide": 0, 
    "print_hide_if_no_value": 0, 
    "read_only": 1, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 0, 
@@ -109,6 +112,7 @@
    "print_hide": 0, 
    "print_hide_if_no_value": 0, 
    "read_only": 0, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 0, 
@@ -119,7 +123,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
-   "columns": 0, 
+   "columns": 2, 
    "fieldname": "total_amount", 
    "fieldtype": "Float", 
    "hidden": 0, 
@@ -135,6 +139,7 @@
    "print_hide": 1, 
    "print_hide_if_no_value": 0, 
    "read_only": 1, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 0, 
@@ -145,7 +150,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
-   "columns": 3, 
+   "columns": 2, 
    "fieldname": "outstanding_amount", 
    "fieldtype": "Float", 
    "hidden": 0, 
@@ -161,6 +166,7 @@
    "print_hide": 0, 
    "print_hide_if_no_value": 0, 
    "read_only": 1, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 0, 
@@ -171,7 +177,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
-   "columns": 3, 
+   "columns": 2, 
    "fieldname": "allocated_amount", 
    "fieldtype": "Float", 
    "hidden": 0, 
@@ -187,6 +193,7 @@
    "print_hide": 0, 
    "print_hide_if_no_value": 0, 
    "read_only": 0, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 0, 
@@ -213,6 +220,7 @@
    "print_hide": 1, 
    "print_hide_if_no_value": 0, 
    "read_only": 1, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 0, 
@@ -230,7 +238,7 @@
  "issingle": 0, 
  "istable": 1, 
  "max_attachments": 0, 
- "modified": "2016-08-26 01:59:04.697274", 
+ "modified": "2016-11-14 12:28:51.822341", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Payment Entry Reference", 
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice_dashboard.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice_dashboard.py
index d4a82c5..6141db5 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice_dashboard.py
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice_dashboard.py
@@ -4,7 +4,6 @@
 	return {
 		'fieldname': 'purchase_invoice',
 		'non_standard_fieldnames': {
-			'Delivery Note': 'against_sales_invoice',
 			'Journal Entry': 'reference_name',
 			'Payment Entry': 'reference_name',
 			'Payment Request': 'reference_name',
@@ -12,8 +11,8 @@
 			'Purchase Invoice': 'return_against'
 		},
 		'internal_links': {
-			'Purchase Order': ['items', 'sales_order'],
-			'Purchase Receipt': ['items', 'delivery_note'],
+			'Purchase Order': ['items', 'purchase_order'],
+			'Purchase Receipt': ['items', 'purchase_receipt'],
 		},
 		'transactions': [
 			{
diff --git a/erpnext/crm/doctype/opportunity/opportunity.js b/erpnext/crm/doctype/opportunity/opportunity.js
index b6346f8..21fba7b 100644
--- a/erpnext/crm/doctype/opportunity/opportunity.js
+++ b/erpnext/crm/doctype/opportunity/opportunity.js
@@ -60,9 +60,10 @@
 			this.frm.doc.enquiry_from = "Lead";
 
 		if(!this.frm.doc.status)
-			set_multiple(cdt, cdn, { status:'Draft' });
+			set_multiple(this.frm.doc.doctype, this.frm.doc.name, { status:'Open' });
 		if(!this.frm.doc.company && frappe.defaults.get_user_default("Company"))
-			set_multiple(cdt, cdn, { company:frappe.defaults.get_user_default("Company") });
+			set_multiple(this.frm.doc.doctype, this.frm.doc.name, 
+				{ company:frappe.defaults.get_user_default("Company") });
 
 		this.setup_queries();
 	},