Merge branch 'hotfix'
diff --git a/erpnext/__init__.py b/erpnext/__init__.py
index 93b058e..78f5352 100644
--- a/erpnext/__init__.py
+++ b/erpnext/__init__.py
@@ -2,7 +2,7 @@
 from __future__ import unicode_literals
 import frappe
 
-__version__ = '7.0.34'
+__version__ = '7.0.35'
 
 def get_default_company(user=None):
 	'''Get default company for user'''
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
index a2e930c..562eaaa 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
@@ -16,6 +16,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "customer_section", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -41,6 +42,7 @@
    "allow_on_submit": 1, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "default": "{customer_name}", 
    "fieldname": "title", 
    "fieldtype": "Data", 
@@ -67,6 +69,7 @@
    "allow_on_submit": 0, 
    "bold": 1, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "naming_series", 
    "fieldtype": "Select", 
    "hidden": 0, 
@@ -94,6 +97,7 @@
    "allow_on_submit": 0, 
    "bold": 1, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "customer", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -121,6 +125,7 @@
    "allow_on_submit": 0, 
    "bold": 1, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "customer", 
    "fieldname": "customer_name", 
    "fieldtype": "Data", 
@@ -148,6 +153,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "is_pos", 
    "fieldtype": "Check", 
    "hidden": 0, 
@@ -174,6 +180,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "is_return", 
    "fieldname": "is_return", 
    "fieldtype": "Check", 
@@ -200,6 +207,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "offline_pos_name", 
    "fieldtype": "Data", 
    "hidden": 1, 
@@ -225,6 +233,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "column_break1", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -249,6 +258,7 @@
    "allow_on_submit": 0, 
    "bold": 1, 
    "collapsible": 0, 
+   "columns": 0, 
    "default": "Today", 
    "fieldname": "posting_date", 
    "fieldtype": "Date", 
@@ -276,6 +286,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "due_date", 
    "fieldtype": "Date", 
    "hidden": 0, 
@@ -302,33 +313,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
-   "fieldname": "mode_of_payment", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Mode of Payment", 
-   "length": 0, 
-   "no_copy": 0, 
-   "oldfieldname": "mode_of_payment", 
-   "oldfieldtype": "Select", 
-   "options": "Mode of Payment", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "company", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -356,6 +341,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "amended_from", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -383,6 +369,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "is_return", 
    "fieldname": "return_against", 
    "fieldtype": "Link", 
@@ -410,6 +397,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 1, 
+   "columns": 0, 
    "depends_on": "", 
    "fieldname": "address_and_contact", 
    "fieldtype": "Section Break", 
@@ -436,6 +424,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "customer_address", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -461,6 +450,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "address_display", 
    "fieldtype": "Small Text", 
    "hidden": 0, 
@@ -485,6 +475,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "contact_person", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -510,6 +501,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "contact_display", 
    "fieldtype": "Small Text", 
    "hidden": 0, 
@@ -534,6 +526,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "contact_mobile", 
    "fieldtype": "Small Text", 
    "hidden": 1, 
@@ -558,6 +551,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "contact_email", 
    "fieldtype": "Data", 
    "hidden": 1, 
@@ -583,6 +577,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "col_break4", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -607,6 +602,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "shipping_address_name", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -633,6 +629,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "shipping_address", 
    "fieldtype": "Small Text", 
    "hidden": 0, 
@@ -658,6 +655,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "description": "", 
    "fieldname": "customer_group", 
    "fieldtype": "Link", 
@@ -684,6 +682,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "territory", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -710,6 +709,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 1, 
+   "columns": 0, 
    "depends_on": "customer", 
    "fieldname": "currency_and_price_list", 
    "fieldtype": "Section Break", 
@@ -736,6 +736,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "currency", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -763,6 +764,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "description": "Rate at which Customer Currency is converted to customer's base currency", 
    "fieldname": "conversion_rate", 
    "fieldtype": "Float", 
@@ -791,6 +793,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "column_break2", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -815,6 +818,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "selling_price_list", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -842,6 +846,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "price_list_currency", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -867,6 +872,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "description": "Rate at which Price list currency is converted to customer's base currency", 
    "fieldname": "plc_conversion_rate", 
    "fieldtype": "Float", 
@@ -893,6 +899,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "ignore_pricing_rule", 
    "fieldtype": "Check", 
    "hidden": 0, 
@@ -917,6 +924,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "items_section", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -943,6 +951,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "update_stock", 
    "fieldtype": "Check", 
    "hidden": 0, 
@@ -969,6 +978,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "items", 
    "fieldtype": "Table", 
    "hidden": 0, 
@@ -996,6 +1006,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "packing_list", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -1021,6 +1032,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "packed_items", 
    "fieldtype": "Table", 
    "hidden": 0, 
@@ -1046,6 +1058,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "product_bundle_help", 
    "fieldtype": "HTML", 
    "hidden": 0, 
@@ -1071,6 +1084,7 @@
    "bold": 0, 
    "collapsible": 1, 
    "collapsible_depends_on": "eval:doc.total_billing_amount > 0", 
+   "columns": 0, 
    "depends_on": "", 
    "fieldname": "time_sheet_list", 
    "fieldtype": "Section Break", 
@@ -1097,6 +1111,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "timesheets", 
    "fieldtype": "Table", 
    "hidden": 0, 
@@ -1123,6 +1138,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "default": "0", 
    "fieldname": "total_billing_amount", 
    "fieldtype": "Currency", 
@@ -1149,6 +1165,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "section_break_30", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -1172,6 +1189,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "base_total", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -1198,6 +1216,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "base_net_total", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -1225,6 +1244,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "column_break_32", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -1248,6 +1268,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "net_total", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -1273,6 +1294,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "total", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -1299,6 +1321,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "taxes_section", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -1325,6 +1348,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "taxes_and_charges", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -1352,6 +1376,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "column_break_38", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -1375,6 +1400,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "shipping_rule", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -1401,6 +1427,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "section_break_40", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -1424,6 +1451,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "taxes", 
    "fieldtype": "Table", 
    "hidden": 0, 
@@ -1451,6 +1479,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "other_charges_calculation", 
    "fieldtype": "HTML", 
    "hidden": 0, 
@@ -1476,6 +1505,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "section_break_43", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -1499,6 +1529,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "base_total_taxes_and_charges", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -1526,6 +1557,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "column_break_47", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -1550,6 +1582,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "total_taxes_and_charges", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -1576,6 +1609,7 @@
    "bold": 0, 
    "collapsible": 1, 
    "collapsible_depends_on": "discount_amount", 
+   "columns": 0, 
    "fieldname": "section_break_49", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -1601,6 +1635,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "default": "Grand Total", 
    "fieldname": "apply_discount_on", 
    "fieldtype": "Select", 
@@ -1628,6 +1663,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "base_discount_amount", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -1654,6 +1690,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "column_break_51", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -1677,6 +1714,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "additional_discount_percentage", 
    "fieldtype": "Float", 
    "hidden": 0, 
@@ -1702,6 +1740,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "discount_amount", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -1727,6 +1766,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "totals", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -1753,6 +1793,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "base_grand_total", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -1780,6 +1821,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "base_rounded_total", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -1807,6 +1849,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "description": "In Words will be visible once you save the Sales Invoice.", 
    "fieldname": "base_in_words", 
    "fieldtype": "Data", 
@@ -1834,6 +1877,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "column_break5", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -1859,6 +1903,7 @@
    "allow_on_submit": 0, 
    "bold": 1, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "grand_total", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -1886,6 +1931,7 @@
    "allow_on_submit": 0, 
    "bold": 1, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "rounded_total", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -1913,6 +1959,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "in_words", 
    "fieldtype": "Data", 
    "hidden": 0, 
@@ -1939,6 +1986,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "total_advance", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -1966,6 +2014,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "outstanding_amount", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -1994,6 +2043,7 @@
    "bold": 0, 
    "collapsible": 1, 
    "collapsible_depends_on": "advances", 
+   "columns": 0, 
    "fieldname": "advances_section", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -2020,6 +2070,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "get_advances", 
    "fieldtype": "Button", 
    "hidden": 0, 
@@ -2046,6 +2097,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "advances", 
    "fieldtype": "Table", 
    "hidden": 0, 
@@ -2074,6 +2126,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "collapsible_depends_on": "", 
+   "columns": 0, 
    "depends_on": "eval:doc.is_pos===1||(doc.advances && doc.advances.length>0)", 
    "fieldname": "payments_section", 
    "fieldtype": "Section Break", 
@@ -2100,6 +2153,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "is_pos", 
    "fieldname": "cash_bank_account", 
    "fieldtype": "Link", 
@@ -2128,6 +2182,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "payments", 
    "fieldtype": "Table", 
    "hidden": 0, 
@@ -2154,6 +2209,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "section_break_84", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -2178,6 +2234,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "base_paid_amount", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -2204,6 +2261,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "column_break_86", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -2228,6 +2286,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "is_pos", 
    "fieldname": "paid_amount", 
    "fieldtype": "Currency", 
@@ -2256,6 +2315,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "section_break_88", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -2280,6 +2340,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "base_change_amount", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -2306,6 +2367,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "column_break_90", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -2330,6 +2392,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "change_amount", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -2356,6 +2419,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "account_for_change_amount", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -2383,6 +2447,7 @@
    "bold": 0, 
    "collapsible": 1, 
    "collapsible_depends_on": "write_off_amount", 
+   "columns": 0, 
    "depends_on": "grand_total", 
    "fieldname": "column_break4", 
    "fieldtype": "Section Break", 
@@ -2409,6 +2474,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "", 
    "fieldname": "write_off_amount", 
    "fieldtype": "Currency", 
@@ -2435,6 +2501,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "base_write_off_amount", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -2461,6 +2528,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "is_pos", 
    "fieldname": "write_off_outstanding_amount_automatically", 
    "fieldtype": "Check", 
@@ -2486,6 +2554,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "", 
    "fieldname": "column_break_74", 
    "fieldtype": "Column Break", 
@@ -2511,6 +2580,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "", 
    "fieldname": "write_off_account", 
    "fieldtype": "Link", 
@@ -2537,6 +2607,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "", 
    "fieldname": "write_off_cost_center", 
    "fieldtype": "Link", 
@@ -2564,6 +2635,7 @@
    "bold": 0, 
    "collapsible": 1, 
    "collapsible_depends_on": "terms", 
+   "columns": 0, 
    "fieldname": "terms_section_break", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -2590,6 +2662,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "tc_name", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -2617,6 +2690,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "terms", 
    "fieldtype": "Text Editor", 
    "hidden": 0, 
@@ -2643,6 +2717,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 1, 
+   "columns": 0, 
    "fieldname": "edit_printing_settings", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -2668,6 +2743,7 @@
    "allow_on_submit": 1, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "letter_head", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -2695,6 +2771,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "language", 
    "fieldtype": "Data", 
    "hidden": 0, 
@@ -2720,6 +2797,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "column_break_84", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -2744,6 +2822,7 @@
    "allow_on_submit": 1, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "select_print_heading", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -2771,6 +2850,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 1, 
+   "columns": 0, 
    "depends_on": "customer", 
    "fieldname": "more_information", 
    "fieldtype": "Section Break", 
@@ -2797,6 +2877,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "project", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -2824,6 +2905,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "col_break23", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -2848,6 +2930,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "eval:doc.source == 'Campaign'", 
    "fieldname": "campaign", 
    "fieldtype": "Link", 
@@ -2876,6 +2959,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "source", 
    "fieldtype": "Select", 
    "hidden": 0, 
@@ -2903,6 +2987,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 1, 
+   "columns": 0, 
    "fieldname": "more_info", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -2929,6 +3014,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "description": "", 
    "fieldname": "debit_to", 
    "fieldtype": "Link", 
@@ -2957,6 +3043,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "party_account_currency", 
    "fieldtype": "Link", 
    "hidden": 1, 
@@ -2983,6 +3070,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "default": "No", 
    "description": "", 
    "fieldname": "is_opening", 
@@ -3012,6 +3100,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "c_form_applicable", 
    "fieldtype": "Select", 
    "hidden": 0, 
@@ -3037,6 +3126,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "c_form_no", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -3062,6 +3152,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "column_break8", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -3086,6 +3177,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "posting_time", 
    "fieldtype": "Time", 
    "hidden": 0, 
@@ -3112,6 +3204,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "remarks", 
    "fieldtype": "Small Text", 
    "hidden": 0, 
@@ -3139,6 +3232,7 @@
    "bold": 0, 
    "collapsible": 1, 
    "collapsible_depends_on": "sales_partner", 
+   "columns": 0, 
    "fieldname": "sales_team_section_break", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -3165,6 +3259,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "sales_partner", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -3192,6 +3287,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "column_break10", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -3217,6 +3313,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "commission_rate", 
    "fieldtype": "Float", 
    "hidden": 0, 
@@ -3243,6 +3340,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "total_commission", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -3271,6 +3369,7 @@
    "bold": 0, 
    "collapsible": 1, 
    "collapsible_depends_on": "sales_team", 
+   "columns": 0, 
    "fieldname": "section_break2", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -3295,6 +3394,7 @@
    "allow_on_submit": 1, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "sales_team", 
    "fieldtype": "Table", 
    "hidden": 0, 
@@ -3323,6 +3423,7 @@
    "bold": 0, 
    "collapsible": 1, 
    "collapsible_depends_on": "is_recurring", 
+   "columns": 0, 
    "depends_on": "eval:doc.docstatus<2", 
    "fieldname": "recurring_invoice", 
    "fieldtype": "Section Break", 
@@ -3349,6 +3450,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "column_break11", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -3374,6 +3476,7 @@
    "allow_on_submit": 1, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "eval:doc.docstatus<2", 
    "description": "", 
    "fieldname": "is_recurring", 
@@ -3400,6 +3503,7 @@
    "allow_on_submit": 1, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "is_recurring", 
    "description": "", 
    "fieldname": "recurring_id", 
@@ -3427,6 +3531,7 @@
    "allow_on_submit": 1, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "eval:doc.is_recurring && doc.recurring_id === doc.name", 
    "description": "", 
    "fieldname": "recurring_type", 
@@ -3454,6 +3559,7 @@
    "allow_on_submit": 1, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "eval:doc.is_recurring && doc.recurring_id === doc.name", 
    "description": "", 
    "fieldname": "repeat_on_day_of_month", 
@@ -3480,6 +3586,7 @@
    "allow_on_submit": 1, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "eval:doc.is_recurring && doc.recurring_id === doc.name", 
    "description": "", 
    "fieldname": "end_date", 
@@ -3506,6 +3613,7 @@
    "allow_on_submit": 1, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "eval:doc.is_recurring && doc.recurring_id === doc.name", 
    "fieldname": "submit_on_creation", 
    "fieldtype": "Check", 
@@ -3532,6 +3640,7 @@
    "allow_on_submit": 1, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "eval:doc.is_recurring && doc.recurring_id === doc.name", 
    "description": "", 
    "fieldname": "notify_by_email", 
@@ -3559,6 +3668,7 @@
    "allow_on_submit": 1, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "eval:doc.is_recurring && doc.notify_by_email && doc.recurring_id === doc.name", 
    "description": "", 
    "fieldname": "notification_email_address", 
@@ -3586,6 +3696,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "eval:doc.is_recurring && doc.notify_by_email && doc.recurring_id === doc.name", 
    "fieldname": "recurring_print_format", 
    "fieldtype": "Link", 
@@ -3613,6 +3724,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "column_break12", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -3638,6 +3750,7 @@
    "allow_on_submit": 1, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "is_recurring", 
    "description": "", 
    "fieldname": "from_date", 
@@ -3664,6 +3777,7 @@
    "allow_on_submit": 1, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "is_recurring", 
    "description": "", 
    "fieldname": "to_date", 
@@ -3690,6 +3804,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "is_recurring", 
    "description": "", 
    "fieldname": "next_date", 
@@ -3716,6 +3831,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "against_income_account", 
    "fieldtype": "Small Text", 
    "hidden": 1, 
@@ -3751,7 +3867,7 @@
  "istable": 0, 
  "max_attachments": 0, 
  "menu_index": 0, 
- "modified": "2016-08-17 15:12:39.357372", 
+ "modified": "2016-08-31 15:47:32.064861", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Sales Invoice", 
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
index b28911e..a5028c5 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -89,6 +89,8 @@
 		set_account_for_mode_of_payment(self)
 
 	def on_submit(self):
+		self.validate_pos_paid_amount()
+
 		if not self.recurring_id:
 			frappe.get_doc('Authorization Control').validate_approving_authority(self.doctype,
 			 	self.company, self.base_grand_total, self)
@@ -121,6 +123,10 @@
 
 		self.update_time_sheet(self.name)
 
+	def validate_pos_paid_amount(self):
+		if len(self.payments) == 0 and self.is_pos:
+			frappe.throw(_("At least one mode of payment is required for POS invoice."))
+
 	def before_cancel(self):
 		self.update_time_sheet(None)
 
@@ -248,7 +254,7 @@
 		from erpnext.stock.get_item_details import get_pos_profile_item_details, get_pos_profile
 		pos = get_pos_profile(self.company)
 
-		if not self.get('payments'):
+		if not self.get('payments') and not for_validate:
 			pos_profile = frappe.get_doc('POS Profile', pos.name) if pos else None
 			update_multi_mode_option(self, pos_profile)
 
diff --git a/erpnext/controllers/taxes_and_totals.py b/erpnext/controllers/taxes_and_totals.py
index 30e21ce..d8b5e2e 100644
--- a/erpnext/controllers/taxes_and_totals.py
+++ b/erpnext/controllers/taxes_and_totals.py
@@ -441,12 +441,15 @@
 			paid_amount = self.doc.paid_amount \
 				if self.doc.party_account_currency == self.doc.currency else self.doc.base_paid_amount
 
+			change_amount = self.doc.change_amount \
+				if self.doc.party_account_currency == self.doc.currency else self.doc.base_change_amount
+
 			self.calculate_write_off_amount()
 			self.calculate_change_amount()
 
 			self.doc.outstanding_amount = flt(total_amount_to_pay - flt(paid_amount) +
-				flt(self.doc.change_amount), self.doc.precision("outstanding_amount"))
-					
+				flt(change_amount), self.doc.precision("outstanding_amount"))
+
 		elif self.doc.doctype == "Purchase Invoice":
 			self.doc.outstanding_amount = flt(total_amount_to_pay, self.doc.precision("outstanding_amount"))
 		
@@ -462,12 +465,13 @@
 
 	def calculate_change_amount(self):
 		self.doc.change_amount = 0.0
+		self.doc.base_change_amount = 0.0
 		if self.doc.paid_amount > self.doc.grand_total:
 			self.doc.change_amount = flt(self.doc.paid_amount - self.doc.grand_total + 
 				self.doc.write_off_amount, self.doc.precision("change_amount"))
 
-		self.doc.base_change_amount = flt(self.doc.change_amount * self.doc.conversion_rate, 
-			self.doc.precision("base_change_amount"))
+			self.doc.base_change_amount = flt(self.doc.base_paid_amount - self.doc.base_grand_total +
+				self.doc.base_write_off_amount, self.doc.precision("base_change_amount"))
 
 	def calculate_write_off_amount(self):
 		if flt(self.doc.change_amount) > 0:
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 76a2409..68a717b 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -9,7 +9,7 @@
 erpnext.patches.v4_0.global_defaults_to_system_settings
 erpnext.patches.v4_0.update_incharge_name_to_sales_person_in_maintenance_schedule
 execute:frappe.reload_doc('stock', 'doctype', 'warehouse')
-execute:frappe.reload_doc('accounts', 'doctype', 'sales_invoice') # 2014-01-29
+execute:frappe.reload_doc('accounts', 'doctype', 'sales_invoice') # 2016-08-31
 execute:frappe.reload_doc('selling', 'doctype', 'sales_order') # 2014-01-29
 execute:frappe.reload_doc('selling', 'doctype', 'quotation') # 2014-01-29
 execute:frappe.reload_doc('stock', 'doctype', 'delivery_note') # 2014-01-29
@@ -276,6 +276,7 @@
 execute:frappe.rename_doc("DocType", "Payments", "Sales Invoice Payment", force=True)
 erpnext.patches.v7_0.update_mins_to_first_response
 erpnext.patches.v6_20x.repost_valuation_rate_for_negative_inventory
+erpnext.patches.v7_0.migrate_mode_of_payments_v6_to_v7
 erpnext.patches.v7_0.system_settings_setup_complete
 erpnext.patches.v7_0.set_naming_series_for_timesheet #2016-07-27
 execute:frappe.reload_doc('projects', 'doctype', 'project')
@@ -311,4 +312,5 @@
 erpnext.patches.v7_0.set_portal_settings
 erpnext.patches.v7_0.repost_future_gle_for_purchase_invoice
 erpnext.patches.v7_0.fix_duplicate_icons
-erpnext.patches.v7_0.repost_gle_for_pos_sales_return
\ No newline at end of file
+erpnext.patches.v7_0.repost_gle_for_pos_sales_return
+erpnext.patches.v7_0.update_missing_employee_in_timesheet
\ No newline at end of file
diff --git a/erpnext/patches/v7_0/convert_timelog_to_timesheet.py b/erpnext/patches/v7_0/convert_timelog_to_timesheet.py
index d00980f..6a6fa26 100644
--- a/erpnext/patches/v7_0/convert_timelog_to_timesheet.py
+++ b/erpnext/patches/v7_0/convert_timelog_to_timesheet.py
@@ -16,6 +16,7 @@
 		time_sheet = make_timesheet(data.production_order)
 		args = get_timelog_data(data)
 		add_timesheet_detail(time_sheet, args)
+		time_sheet.employee = data.employee
 		time_sheet.note = data.note
 		time_sheet.company = company
 		
diff --git a/erpnext/patches/v7_0/create_warehouse_nestedset.py b/erpnext/patches/v7_0/create_warehouse_nestedset.py
index af39cc8..8190fd7 100644
--- a/erpnext/patches/v7_0/create_warehouse_nestedset.py
+++ b/erpnext/patches/v7_0/create_warehouse_nestedset.py
@@ -1,3 +1,5 @@
+
+from __future__ import unicode_literals
 import frappe
 from frappe import _
 from frappe.utils import cint
diff --git a/erpnext/patches/v7_0/migrate_mode_of_payments_v6_to_v7.py b/erpnext/patches/v7_0/migrate_mode_of_payments_v6_to_v7.py
new file mode 100644
index 0000000..e2d2c89
--- /dev/null
+++ b/erpnext/patches/v7_0/migrate_mode_of_payments_v6_to_v7.py
@@ -0,0 +1,20 @@
+from __future__ import unicode_literals
+import frappe
+
+def execute():
+	frappe.reload_doc('accounts', 'doctype', 'sales_invoice_timesheet')
+	frappe.reload_doc('accounts', 'doctype', 'sales_invoice_payment')
+	
+	for data in frappe.db.sql("""select name, mode_of_payment, cash_bank_account, paid_amount from 
+		`tabSales Invoice` where is_pos = 1 and docstatus < 2 and cash_bank_account is not null""", as_dict=1):
+		si_doc = frappe.get_doc('Sales Invoice', data.name)
+		si_doc.append('payments', {
+			'mode_of_payment': data.mode_of_payment or 'Cash',
+			'account': data.cash_bank_account,
+			'type': frappe.db.get_value('Mode of Payment', data.mode_of_payment, 'type') or 'Cash',
+			'amount': data.paid_amount
+		})
+
+		si_doc.set_paid_amount()
+		si_doc.flags.ignore_validate_update_after_submit = True
+		si_doc.save()
\ No newline at end of file
diff --git a/erpnext/patches/v7_0/update_missing_employee_in_timesheet.py b/erpnext/patches/v7_0/update_missing_employee_in_timesheet.py
new file mode 100644
index 0000000..c74a40a
--- /dev/null
+++ b/erpnext/patches/v7_0/update_missing_employee_in_timesheet.py
@@ -0,0 +1,19 @@
+from __future__ import unicode_literals
+import frappe
+
+def execute():
+	timesheet = frappe.db.sql("""select tl.employee as employee, ts.name as name,
+			tl.modified as modified, tl.modified_by as modified_by, tl.creation as creation, tl.owner as owner
+		from 
+			`tabTimesheet` ts, `tabTimesheet Detail` tsd, `tabTime Log` tl
+		where 
+			tsd.parent = ts.name and tl.from_time = tsd.from_time and tl.to_time = tsd.to_time 
+			and tl.hours = tsd.hours and tl.billing_rate = tsd.billing_rate and tsd.idx=1 
+			and tl.docstatus < 2 and (ts.employee = '' or ts.employee is null)""", as_dict=1)
+		
+	for data in timesheet:
+		ts_doc = frappe.get_doc('Timesheet', data.name)
+		if len(ts_doc.time_logs) == 1:
+			frappe.db.sql(""" update `tabTimesheet` set creation = %(creation)s,
+				owner = %(owner)s, modified = %(modified)s, modified_by = %(modified_by)s,
+				employee = %(employee)s where name = %(name)s""", data)
diff --git a/erpnext/projects/doctype/timesheet/timesheet.json b/erpnext/projects/doctype/timesheet/timesheet.json
index 16d71d8..3dd5513 100644
--- a/erpnext/projects/doctype/timesheet/timesheet.json
+++ b/erpnext/projects/doctype/timesheet/timesheet.json
@@ -16,6 +16,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "naming_series", 
    "fieldtype": "Select", 
    "hidden": 0, 
@@ -41,6 +42,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "company", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -67,6 +69,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "", 
    "description": "", 
    "fieldname": "sales_invoice", 
@@ -94,6 +97,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "column_break_3", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -117,6 +121,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "", 
    "fieldname": "salary_slip", 
    "fieldtype": "Link", 
@@ -144,6 +149,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "default": "Draft", 
    "fieldname": "status", 
    "fieldtype": "Select", 
@@ -171,7 +177,8 @@
    "bold": 0, 
    "collapsible": 0, 
    "collapsible_depends_on": "", 
-   "depends_on": "eval:!doc.production_order", 
+   "columns": 0, 
+   "depends_on": "eval:!doc.production_order || doc.docstatus == 1", 
    "fieldname": "employee_detail", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -197,6 +204,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "", 
    "description": "List of employee which has \"Salary Slip Based on Timesheet\" is enabled in salary structure.", 
    "fieldname": "employee", 
@@ -225,6 +233,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "employee", 
    "fieldname": "employee_name", 
    "fieldtype": "Data", 
@@ -252,6 +261,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "user", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -278,6 +288,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "column_break_9", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -302,6 +313,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "start_date", 
    "fieldtype": "Date", 
    "hidden": 0, 
@@ -327,6 +339,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "end_date", 
    "fieldtype": "Date", 
    "hidden": 0, 
@@ -353,6 +366,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "collapsible_depends_on": "", 
+   "columns": 0, 
    "depends_on": "production_order", 
    "fieldname": "production_detail", 
    "fieldtype": "Section Break", 
@@ -379,6 +393,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "production_order", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -405,6 +420,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "section_break_5", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -428,6 +444,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "time_logs", 
    "fieldtype": "Table", 
    "hidden": 0, 
@@ -453,6 +470,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "section_break_8", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -477,6 +495,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "default": "0", 
    "description": "", 
    "fieldname": "total_hours", 
@@ -503,6 +522,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "column_break_10", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -527,6 +547,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "default": "0", 
    "depends_on": "", 
    "description": "", 
@@ -555,6 +576,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "total_costing_amount", 
    "fieldtype": "Float", 
    "hidden": 0, 
@@ -580,6 +602,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "section_break_18", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -604,6 +627,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "note", 
    "fieldtype": "Text Editor", 
    "hidden": 0, 
@@ -629,6 +653,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "amended_from", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -662,7 +687,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2016-08-01 08:54:31.840829", 
+ "modified": "2016-09-01 11:33:38.110421", 
  "modified_by": "Administrator", 
  "module": "Projects", 
  "name": "Timesheet", 
diff --git a/erpnext/public/js/controllers/taxes_and_totals.js b/erpnext/public/js/controllers/taxes_and_totals.js
index 8e14922..2149f6d 100644
--- a/erpnext/public/js/controllers/taxes_and_totals.js
+++ b/erpnext/public/js/controllers/taxes_and_totals.js
@@ -72,7 +72,7 @@
 	},
 
 	validate_conversion_rate: function() {
-		this.frm.doc.conversion_rate = flt(this.frm.doc.conversion_rate, precision("conversion_rate"));
+		this.frm.doc.conversion_rate = flt(this.frm.doc.conversion_rate, (cur_frm) ? precision("conversion_rate") : 9);
 		var conversion_rate_label = frappe.meta.get_label(this.frm.doc.doctype, "conversion_rate",
 			this.frm.doc.name);
 		var company_currency = this.frm.doc.currency || this.get_company_currency();
@@ -572,8 +572,11 @@
 			var paid_amount = (this.frm.doc.party_account_currency == this.frm.doc.currency) ?
 				this.frm.doc.paid_amount : this.frm.doc.base_paid_amount;
 
-			this.frm.doc.outstanding_amount =  flt(total_amount_to_pay - flt(paid_amount) + 
-				flt(this.frm.doc.change_amount), precision("outstanding_amount"));
+			var change_amount = (this.frm.doc.party_account_currency == this.frm.doc.currency) ?
+				this.frm.doc.change_amount : this.frm.doc.base_change_amount;
+
+			this.frm.doc.outstanding_amount =  flt(total_amount_to_pay - flt(paid_amount) +
+				flt(this.frm.doc.change_amount * this.frm.doc.conversion_rate), precision("outstanding_amount"));
 
 		} else if(this.frm.doc.doctype == "Purchase Invoice") {
 			this.frm.doc.outstanding_amount = flt(total_amount_to_pay, precision("outstanding_amount"));
@@ -585,7 +588,7 @@
 		payment_status = true;
 		if(this.frm.doc.is_pos && (update_paid_amount===undefined || update_paid_amount)){
 			$.each(this.frm.doc['payments'] || [], function(index, data){
-				if(data.type == "Cash" && payment_status) {
+				if(data.type == "Cash" && payment_status && total_amount_to_pay > 0) {
 					data.base_amount = flt(total_amount_to_pay, precision("base_amount"));
 					data.amount = flt(total_amount_to_pay / me.frm.doc.conversion_rate, precision("amount"));
 					payment_status = false;
@@ -612,12 +615,11 @@
 	calculate_change_amount: function(){
 		this.frm.doc.change_amount = 0.0;
 		if(this.frm.doc.paid_amount > this.frm.doc.grand_total && !this.frm.doc.is_return){
-			this.frm.doc.change_amount = flt(this.frm.doc.paid_amount - this.frm.doc.grand_total + 
+			this.frm.doc.change_amount = flt(this.frm.doc.paid_amount - this.frm.doc.grand_total +
 				this.frm.doc.write_off_amount, precision("change_amount"));
+			this.frm.doc.base_change_amount = flt(this.frm.doc.base_paid_amount - this.frm.doc.base_grand_total +
+				this.frm.doc.base_write_off_amount, precision("base_change_amount"));
 		}
-
-		this.frm.doc.base_change_amount = flt(this.frm.doc.change_amount * this.frm.doc.conversion_rate,
-			precision("base_change_amount"));
 	},
 
 	calculate_write_off_amount: function(){
diff --git a/erpnext/public/js/payment/payment_details.html b/erpnext/public/js/payment/payment_details.html
index 596f139..3e63944 100644
--- a/erpnext/public/js/payment/payment_details.html
+++ b/erpnext/public/js/payment/payment_details.html
@@ -2,7 +2,7 @@
     <div class="col-xs-6" style="padding:20px">{{mode_of_payment}}</div>
 	<div class="col-xs-6">
 		<div class="input-group">
-			<input disabled class="form-control text-right amount" idx="{{idx}}" type="text" value="{{format_number(amount, 2)}}">
+			<input disabled class="form-control text-right amount" idx="{{idx}}" type="text" value="{%= format_currency(amount, currency) %}">
 			<span class="input-group-btn">
 				<button type="button" class="btn btn-default clr" idx="{{idx}}" style="border:1px solid #d1d8dd">C</button>
 			</span>
diff --git a/erpnext/public/js/payment/payments.js b/erpnext/public/js/payment/payments.js
index 23db61f..438ad79 100644
--- a/erpnext/public/js/payment/payments.js
+++ b/erpnext/public/js/payment/payments.js
@@ -84,8 +84,8 @@
 		this.payment_val = 0.0
 		if(this.frm.doc.outstanding_amount > 0 && flt(this.selected_mode.val()) == 0.0){
 			//When user first time click on row
-			this.payment_val = flt(this.frm.doc.outstanding_amount)
-			this.selected_mode.val(format_number(this.payment_val, 2));
+			this.payment_val = flt(this.frm.doc.outstanding_amount / this.frm.doc.conversion_rate, precision("outstanding_amount"))
+			this.selected_mode.val(format_currency(this.payment_val, this.frm.doc.currency));
 			this.update_payment_amount()
 		}else if(flt(this.selected_mode.val()) > 0){
 			//If user click on existing row which has value
@@ -137,14 +137,14 @@
 		var me = this;
 		$(this.$body).find('.pos-keyboard-key').click(function(){
 			me.payment_val += $(this).text();
-			me.selected_mode.val(format_number(me.payment_val, 2))
+			me.selected_mode.val(format_currency(me.payment_val, me.frm.doc.currency))
 			me.idx = me.selected_mode.attr("idx")
 			me.update_paid_amount()
 		})
 		
 		$(this.$body).find('.delete-btn').click(function(){
 			me.payment_val =  cstr(flt(me.selected_mode.val())).slice(0, -1);
-			me.selected_mode.val(format_number(me.payment_val, 2));
+			me.selected_mode.val(format_currency(me.payment_val, me.frm.doc.currency));
 			me.idx = me.selected_mode.attr("idx")
 			me.update_paid_amount();
 		})
@@ -155,7 +155,7 @@
 		var me = this;
 		this.selected_mode.change(function(){
 			me.payment_val =  flt($(this).val()) || 0.0;
-			me.selected_mode.val(format_number(me.payment_val, 2))
+			me.selected_mode.val(format_currency(me.payment_val, me.frm.doc.currency))
 			me.idx = me.selected_mode.attr("idx")
 			me.update_payment_amount()
 		})
@@ -199,8 +199,8 @@
 			if(me.idx == 'change_amount'){
 				me.change_amount(value)
 			} else{
-				if(value == 0 && update_write_off) {
-					value = me.frm.doc.outstanding_amount;
+				if(flt(value) == 0 && update_write_off && me.frm.doc.outstanding_amount > 0) {
+					value = flt(me.frm.doc.outstanding_amount / me.frm.doc.conversion_rate, precision(me.idx));
 				}
 				me.write_off_amount(value)
 			}
@@ -224,10 +224,10 @@
 
 	show_amounts: function(){
 		var me = this;
-		$(this.$body).find(".write_off_amount").val(format_number(this.frm.doc.write_off_amount, precision("write_off_amount")));
+		$(this.$body).find(".write_off_amount").val(format_currency(this.frm.doc.write_off_amount, this.frm.doc.currency));
 		$(this.$body).find('.paid_amount').text(format_currency(this.frm.doc.paid_amount, this.frm.doc.currency));
-		$(this.$body).find('.change_amount').val(format_number(this.frm.doc.change_amount, precision("change_amount")))
-		$(this.$body).find('.outstanding_amount').text(format_currency(this.frm.doc.outstanding_amount, this.frm.doc.currency))
+		$(this.$body).find('.change_amount').val(format_currency(this.frm.doc.change_amount, this.frm.doc.currency))
+		$(this.$body).find('.outstanding_amount').text(format_currency(this.frm.doc.outstanding_amount, frappe.get_doc(":Company", this.frm.doc.company).default_currency))
 		this.update_invoice();
 	}
 })
\ No newline at end of file