fix(reports): Made gstr1 ready for govt portal
diff --git a/erpnext/accounts/doctype/payment_schedule/payment_schedule.json b/erpnext/accounts/doctype/payment_schedule/payment_schedule.json
index 83e3ba0..1b38904 100644
--- a/erpnext/accounts/doctype/payment_schedule/payment_schedule.json
+++ b/erpnext/accounts/doctype/payment_schedule/payment_schedule.json
@@ -15,6 +15,7 @@
  "fields": [
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -47,11 +48,12 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
    "columns": 2, 
-   "fetch_from": "payment_term.description",
+   "fetch_from": "", 
    "fieldname": "description", 
    "fieldtype": "Small Text", 
    "hidden": 0, 
@@ -80,6 +82,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -112,11 +115,12 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
    "columns": 2, 
-   "fetch_from": "payment_term.invoice_portion", 
+   "fetch_from": "", 
    "fieldname": "invoice_portion", 
    "fieldtype": "Percent", 
    "hidden": 0, 
@@ -145,6 +149,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -177,6 +182,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_in_quick_entry": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -218,7 +224,7 @@
  "issingle": 0, 
  "istable": 1, 
  "max_attachments": 0, 
- "modified": "2018-05-25 22:43:31.890251",
+ "modified": "2018-09-06 17:35:44.580209", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Payment Schedule", 
@@ -232,5 +238,6 @@
  "sort_field": "modified", 
  "sort_order": "DESC", 
  "track_changes": 1, 
- "track_seen": 0
+ "track_seen": 0, 
+ "track_views": 0
 }
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
index e00d17d..f73a303 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
@@ -6,7 +6,6 @@
 
 {% include 'erpnext/selling/sales_common.js' %};
 
-cur_frm.add_fetch('customer', 'tax_id', 'tax_id');
 
 frappe.provide("erpnext.accounts");
 erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.extend({
@@ -544,6 +543,9 @@
 
 frappe.ui.form.on('Sales Invoice', {
 	setup: function(frm){
+		frm.add_fetch('customer', 'tax_id', 'tax_id');
+		frm.add_fetch('payment_term', 'invoice_portion', 'invoice_portion');
+		frm.add_fetch('payment_term', 'description', 'description');
 
 		frm.custom_make_buttons = {
 			'Delivery Note': 'Delivery',
diff --git a/erpnext/regional/report/gstr_1/gstr_1.py b/erpnext/regional/report/gstr_1/gstr_1.py
index edd5519..fa2d2af 100644
--- a/erpnext/regional/report/gstr_1/gstr_1.py
+++ b/erpnext/regional/report/gstr_1/gstr_1.py
@@ -4,8 +4,9 @@
 from __future__ import unicode_literals
 import frappe, json
 from frappe import _
-from frappe.utils import flt
+from frappe.utils import flt, formatdate
 from datetime import date
+from six import iteritems
 
 def execute(filters=None):
 	return Gstr1Report(filters).run()
@@ -73,12 +74,17 @@
 				row.append(abs(invoice_details.base_rounded_total) or abs(invoice_details.base_grand_total))
 			elif fieldname == "invoice_value":
 				row.append(invoice_details.base_rounded_total or invoice_details.base_grand_total)
+			elif fieldname in ('posting_date', 'shipping_bill_date'):
+				row.append(formatdate(invoice_details.get(fieldname), 'dd-MMM-YY'))
+			elif fieldname == "export_type":
+				export_type = "WPAY" if invoice_details.get(fieldname)=="With Payment of Tax" else "WOPAY"
+				row.append(export_type)
 			else:
 				row.append(invoice_details.get(fieldname))
 
 		taxable_value = sum([abs(net_amount)
 			for item_code, net_amount in self.invoice_items.get(invoice).items() if item_code in items])
-		row += [tax_rate, taxable_value]
+		row += [tax_rate or 0, taxable_value]
 
 		return row, taxable_value
 
@@ -195,6 +201,12 @@
 		if unidentified_gst_accounts:
 			frappe.msgprint(_("Following accounts might be selected in GST Settings:")
 				+ "<br>" + "<br>".join(unidentified_gst_accounts), alert=True)
+		
+		# Build itemised tax for export invoices where tax table is blank
+		for invoice, items in iteritems(self.invoice_items):
+			if invoice not in self.items_based_on_tax_rate \
+				and frappe.db.get_value(self.doctype, invoice, "export_type") == "Without Payment of Tax":
+					self.items_based_on_tax_rate.setdefault(invoice, {}).setdefault(0, items.keys())
 
 	def get_gst_accounts(self):
 		self.gst_accounts = frappe._dict()
@@ -250,7 +262,7 @@
 				{
 					"fieldname": "posting_date",
 					"label": "Invoice date",
-					"fieldtype": "Date",
+					"fieldtype": "Data",
 					"width":80
 				},
 				{
@@ -261,7 +273,7 @@
 				},
 				{
 					"fieldname": "place_of_supply",
-					"label": "Place of Supply",
+					"label": "Place Of Supply",
 					"fieldtype": "Data",
 					"width":100
 				},
@@ -303,7 +315,7 @@
 				{
 					"fieldname": "posting_date",
 					"label": "Invoice date",
-					"fieldtype": "Date",
+					"fieldtype": "Data",
 					"width": 100
 				},
 				{
@@ -314,7 +326,7 @@
 				},
 				{
 					"fieldname": "place_of_supply",
-					"label": "Place of Supply",
+					"label": "Place Of Supply",
 					"fieldtype": "Data",
 					"width": 120
 				},
@@ -357,7 +369,7 @@
 				{
 					"fieldname": "posting_date",
 					"label": "Invoice/Advance Receipt date",
-					"fieldtype": "Date",
+					"fieldtype": "Data",
 					"width": 120
 				},
 				{
@@ -368,12 +380,6 @@
 					"width":120
 				},
 				{
-					"fieldname": "posting_date",
-					"label": "Invoice/Advance Receipt date",
-					"fieldtype": "Date",
-					"width": 120
-				},
-				{
 					"fieldname": "reason_for_issuing_document",
 					"label": "Reason For Issuing document",
 					"fieldtype": "Data",
@@ -381,7 +387,7 @@
 				},
 				{
 					"fieldname": "place_of_supply",
-					"label": "Place of Supply",
+					"label": "Place Of Supply",
 					"fieldtype": "Data",
 					"width": 120
 				},
@@ -416,7 +422,7 @@
 			self.invoice_columns = [
 				{
 					"fieldname": "place_of_supply",
-					"label": "Place of Supply",
+					"label": "Place Of Supply",
 					"fieldtype": "Data",
 					"width": 120
 				},
@@ -459,7 +465,7 @@
 				{
 					"fieldname": "posting_date",
 					"label": "Invoice date",
-					"fieldtype": "Date",
+					"fieldtype": "Data",
 					"width": 120
 				},
 				{
@@ -483,7 +489,7 @@
 				{
 					"fieldname": "shipping_bill_date",
 					"label": "Shipping Bill Date",
-					"fieldtype": "Date",
+					"fieldtype": "Data",
 					"width": 120
 				}
 			]
diff --git a/erpnext/stock/report/stock_balance/stock_balance.json b/erpnext/stock/report/stock_balance/stock_balance.json
index 4afbf75..2f20b20 100644
--- a/erpnext/stock/report/stock_balance/stock_balance.json
+++ b/erpnext/stock/report/stock_balance/stock_balance.json
@@ -1,17 +1,17 @@
 {
  "add_total_row": 1, 
- "apply_user_permissions": 1, 
  "creation": "2014-10-10 17:58:11.577901", 
  "disabled": 0, 
  "docstatus": 0, 
  "doctype": "Report", 
  "idx": 2, 
  "is_standard": "Yes", 
- "modified": "2017-02-24 20:10:13.764665", 
+ "modified": "2018-08-14 15:24:41.395557", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Stock Balance", 
  "owner": "Administrator", 
+ "prepared_report": 1, 
  "ref_doctype": "Stock Ledger Entry", 
  "report_name": "Stock Balance", 
  "report_type": "Script Report",