Merge pull request #14962 from saurabh6790/staging_version_1

Update staging version to support semantic versioning
diff --git a/erpnext/accounts/doctype/fiscal_year/fiscal_year.py b/erpnext/accounts/doctype/fiscal_year/fiscal_year.py
index 92da787..a00aebe 100644
--- a/erpnext/accounts/doctype/fiscal_year/fiscal_year.py
+++ b/erpnext/accounts/doctype/fiscal_year/fiscal_year.py
@@ -109,3 +109,14 @@
 			new_fy.insert(ignore_permissions=True)
 		except frappe.NameError:
 			pass
+
+def get_from_and_to_date(fiscal_year):
+	from_and_to_date_tuple = frappe.db.sql("""select year_start_date, year_end_date
+		from `tabFiscal Year` where name=%s""", (fiscal_year))[0]
+
+	from_and_to_date = {
+		"from_date": from_and_to_date_tuple[0],
+		"to_date": from_and_to_date_tuple[1]
+	}
+
+	return from_and_to_date
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
index 3d261d4..f01caad 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
@@ -15,7 +15,6 @@
  "engine": "InnoDB", 
  "fields": [
   {
-<<<<<<< HEAD
    "allow_bulk_edit": 0, 
    "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
@@ -5443,7 +5442,7 @@
  "istable": 0, 
  "max_attachments": 0, 
  "menu_index": 0, 
- "modified": "2018-07-12 13:16:20.918322",
+ "modified": "2018-07-18 13:16:20.918322",
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Sales Invoice", 
diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py
index b1b3260..d7fe123 100644
--- a/erpnext/accounts/party.py
+++ b/erpnext/accounts/party.py
@@ -34,8 +34,6 @@
 def _get_party_details(party=None, account=None, party_type="Customer", company=None, posting_date=None,
 	bill_date=None, price_list=None, currency=None, doctype=None, ignore_permissions=False, fetch_payment_terms_template=True):
 
-	out = frappe._dict(set_account_and_due_date(party, account, party_type, company, posting_date, doctype))
-
 	out = frappe._dict(set_account_and_due_date(party, account, party_type, company, posting_date, bill_date, doctype))
 	party = out[party_type.lower()]
 
diff --git a/erpnext/accounts/report/utils.py b/erpnext/accounts/report/utils.py
index 4490398..d1995d2 100644
--- a/erpnext/accounts/report/utils.py
+++ b/erpnext/accounts/report/utils.py
@@ -1,7 +1,8 @@
 import frappe
 from erpnext import get_company_currency, get_default_company
 from erpnext.setup.utils import get_exchange_rate
-from frappe.utils import cint
+from erpnext.accounts.doctype.fiscal_year.fiscal_year import get_from_and_to_date
+from frappe.utils import cint, get_datetime_str, formatdate
 
 __exchange_rates = {}
 P_OR_L_ACCOUNTS = list(
@@ -26,7 +27,12 @@
 	company = get_appropriate_company(filters)
 	company_currency = get_company_currency(company)
 	presentation_currency = filters['presentation_currency'] if filters.get('presentation_currency') else company_currency
-	report_date = filters.get('to_date') or filters.get('to_fiscal_year')
+
+	report_date = filters.get('to_date')
+
+	if not report_date:
+		fiscal_year_to_date = get_from_and_to_date(filters.get('to_fiscal_year'))["to_date"]
+		report_date = formatdate(get_datetime_str(fiscal_year_to_date), "dd-MM-yyyy")
 
 	currency_map = dict(company=company, company_currency=company_currency, presentation_currency=presentation_currency, report_date=report_date)
 
@@ -58,6 +64,7 @@
 	:param to_currency: Quote currency
 	:return: Retrieved exchange rate
 	"""
+
 	rate = __exchange_rates.get('{0}-{1}@{2}'.format(from_currency, to_currency, date))
 	if not rate:
 		rate = get_exchange_rate(from_currency, to_currency, date) or 1
diff --git a/erpnext/support/doctype/issue/issue.py b/erpnext/support/doctype/issue/issue.py
index 43cfd3f..c7b5e06 100644
--- a/erpnext/support/doctype/issue/issue.py
+++ b/erpnext/support/doctype/issue/issue.py
@@ -135,7 +135,10 @@
 		set_status(name, status)
 
 def has_website_permission(doc, ptype, user, verbose=False):
-	return doc.raised_by==user
+	from erpnext.controllers.website_list_for_contact import has_website_permission
+	permission_based_on_customer = has_website_permission(doc, ptype, user, verbose)
+
+	return permission_based_on_customer or doc.raised_by==user
 
 
 def update_issue(contact, method):