Fixed merge conflict
diff --git a/erpnext/accounts/doctype/account/account.json b/erpnext/accounts/doctype/account/account.json
index e60d9ab..82c9c66 100644
--- a/erpnext/accounts/doctype/account/account.json
+++ b/erpnext/accounts/doctype/account/account.json
@@ -3,29 +3,57 @@
  "allow_import": 1, 
  "allow_rename": 1, 
  "creation": "2013-01-30 12:49:46", 
+ "custom": 0, 
  "description": "Heads (or groups) against which Accounting Entries are made and balances are maintained.", 
  "docstatus": 0, 
  "doctype": "DocType", 
- "document_type": "Master", 
+ "document_type": "Setup", 
  "fields": [
   {
+   "allow_on_submit": 0, 
    "fieldname": "properties", 
    "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
+   "no_copy": 0, 
    "oldfieldtype": "Section Break", 
-   "permlevel": 0
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
   }, 
   {
+   "allow_on_submit": 0, 
    "fieldname": "column_break0", 
    "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
    "in_list_view": 0, 
+   "no_copy": 0, 
    "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0, 
    "width": "50%"
   }, 
   {
+   "allow_on_submit": 0, 
    "fieldname": "account_name", 
    "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Account Name", 
@@ -33,147 +61,335 @@
    "oldfieldname": "account_name", 
    "oldfieldtype": "Data", 
    "permlevel": 0, 
+   "print_hide": 0, 
    "read_only": 1, 
+   "report_hide": 0, 
    "reqd": 1, 
-   "search_index": 0
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
   }, 
   {
+   "allow_on_submit": 0, 
    "default": "0", 
    "fieldname": "is_group", 
    "fieldtype": "Check", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
    "label": "Is Group", 
+   "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
-   "search_index": 0
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
   }, 
   {
+   "allow_on_submit": 0, 
    "fieldname": "company", 
    "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
    "in_filter": 1, 
+   "in_list_view": 0, 
    "label": "Company", 
+   "no_copy": 0, 
    "oldfieldname": "company", 
    "oldfieldtype": "Link", 
    "options": "Company", 
    "permlevel": 0, 
+   "print_hide": 0, 
    "read_only": 1, 
+   "report_hide": 0, 
    "reqd": 1, 
-   "search_index": 0
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
   }, 
   {
+   "allow_on_submit": 0, 
    "fieldname": "root_type", 
    "fieldtype": "Select", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
    "label": "Root Type", 
+   "no_copy": 0, 
    "options": "\nAsset\nLiability\nIncome\nExpense\nEquity", 
    "permlevel": 0, 
-   "read_only": 1
+   "print_hide": 0, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
   }, 
   {
+   "allow_on_submit": 0, 
    "fieldname": "report_type", 
    "fieldtype": "Select", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
    "label": "Report Type", 
+   "no_copy": 0, 
    "options": "\nBalance Sheet\nProfit and Loss", 
    "permlevel": 0, 
-   "read_only": 1
+   "print_hide": 0, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
   }, 
   {
+   "allow_on_submit": 0, 
+   "fieldname": "currency", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Currency", 
+   "no_copy": 0, 
+   "options": "Currency", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
    "fieldname": "column_break1", 
    "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "no_copy": 0, 
    "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0, 
    "width": "50%"
   }, 
   {
+   "allow_on_submit": 0, 
    "fieldname": "parent_account", 
    "fieldtype": "Link", 
+   "hidden": 0, 
    "ignore_user_permissions": 1, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
    "label": "Parent Account", 
+   "no_copy": 0, 
    "oldfieldname": "parent_account", 
    "oldfieldtype": "Link", 
    "options": "Account", 
    "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
    "reqd": 1, 
-   "search_index": 1
+   "search_index": 1, 
+   "set_only_once": 0, 
+   "unique": 0
   }, 
   {
-   "description": "Setting Account Type helps in selecting this Account in transactions.", 
+   "allow_on_submit": 0, 
+   "description": "", 
    "fieldname": "account_type", 
    "fieldtype": "Select", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
    "in_filter": 1, 
+   "in_list_view": 0, 
    "label": "Account Type", 
+   "no_copy": 0, 
    "oldfieldname": "account_type", 
    "oldfieldtype": "Select", 
    "options": "\nBank\nCash\nTax\nChargeable\nWarehouse\nReceivable\nPayable\nEquity\nFixed Asset\nCost of Goods Sold\nExpense Account\nRound Off\nIncome Account\nStock Received But Not Billed\nExpenses Included In Valuation\nStock Adjustment\nStock\nTemporary", 
    "permlevel": 0, 
-   "search_index": 0
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
   }, 
   {
+   "allow_on_submit": 0, 
    "description": "Rate at which this tax is applied", 
    "fieldname": "tax_rate", 
    "fieldtype": "Float", 
    "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
    "label": "Rate", 
+   "no_copy": 0, 
    "oldfieldname": "tax_rate", 
    "oldfieldtype": "Currency", 
    "permlevel": 0, 
-   "reqd": 0
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
   }, 
   {
+   "allow_on_submit": 0, 
    "description": "If the account is frozen, entries are allowed to restricted users.", 
    "fieldname": "freeze_account", 
    "fieldtype": "Select", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
    "label": "Frozen", 
+   "no_copy": 0, 
    "oldfieldname": "freeze_account", 
    "oldfieldtype": "Select", 
    "options": "No\nYes", 
-   "permlevel": 0
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
   }, 
   {
+   "allow_on_submit": 0, 
    "fieldname": "warehouse", 
    "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
    "label": "Warehouse", 
+   "no_copy": 0, 
    "options": "Warehouse", 
-   "permlevel": 0
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
   }, 
   {
+   "allow_on_submit": 0, 
    "fieldname": "balance_must_be", 
    "fieldtype": "Select", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
    "label": "Balance must be", 
+   "no_copy": 0, 
    "options": "\nDebit\nCredit", 
-   "permlevel": 0
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
   }, 
   {
+   "allow_on_submit": 0, 
    "fieldname": "lft", 
    "fieldtype": "Int", 
    "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
    "label": "Lft", 
+   "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 1, 
    "read_only": 1, 
-   "search_index": 1
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 1, 
+   "set_only_once": 0, 
+   "unique": 0
   }, 
   {
+   "allow_on_submit": 0, 
    "fieldname": "rgt", 
    "fieldtype": "Int", 
    "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
    "label": "Rgt", 
+   "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 1, 
    "read_only": 1, 
-   "search_index": 1
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 1, 
+   "set_only_once": 0, 
+   "unique": 0
   }, 
   {
+   "allow_on_submit": 0, 
    "fieldname": "old_parent", 
    "fieldtype": "Data", 
    "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
    "label": "Old Parent", 
+   "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 1, 
-   "read_only": 1
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
   }
  ], 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
  "icon": "icon-money", 
  "idx": 1, 
  "in_create": 0, 
- "modified": "2015-07-20 03:54:14.297995", 
+ "in_dialog": 0, 
+ "is_submittable": 0, 
+ "issingle": 0, 
+ "istable": 0, 
+ "modified": "2015-08-13 16:43:10.645538", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Account", 
@@ -182,16 +398,19 @@
   {
    "amend": 0, 
    "apply_user_permissions": 1, 
+   "cancel": 0, 
    "create": 1, 
    "delete": 1, 
    "email": 1, 
    "export": 1, 
+   "if_owner": 0, 
    "import": 1, 
    "permlevel": 0, 
    "print": 1, 
    "read": 1, 
    "report": 1, 
    "role": "Accounts User", 
+   "set_user_permissions": 0, 
    "share": 1, 
    "submit": 0, 
    "write": 1
@@ -199,52 +418,72 @@
   {
    "amend": 0, 
    "apply_user_permissions": 1, 
+   "cancel": 0, 
    "create": 0, 
    "delete": 0, 
    "email": 1, 
+   "export": 0, 
+   "if_owner": 0, 
+   "import": 0, 
    "permlevel": 0, 
    "print": 1, 
    "read": 1, 
    "report": 1, 
    "role": "Auditor", 
+   "set_user_permissions": 0, 
+   "share": 0, 
    "submit": 0, 
    "write": 0
   }, 
   {
    "amend": 0, 
    "apply_user_permissions": 1, 
+   "cancel": 0, 
    "create": 0, 
    "delete": 0, 
    "email": 1, 
+   "export": 0, 
+   "if_owner": 0, 
+   "import": 0, 
    "permlevel": 0, 
    "print": 1, 
    "read": 1, 
    "report": 1, 
    "role": "Sales User", 
+   "set_user_permissions": 0, 
+   "share": 0, 
    "submit": 0, 
    "write": 0
   }, 
   {
    "amend": 0, 
    "apply_user_permissions": 1, 
+   "cancel": 0, 
    "create": 0, 
    "delete": 0, 
    "email": 1, 
+   "export": 0, 
+   "if_owner": 0, 
+   "import": 0, 
    "permlevel": 0, 
    "print": 1, 
    "read": 1, 
    "report": 1, 
    "role": "Purchase User", 
+   "set_user_permissions": 0, 
+   "share": 0, 
    "submit": 0, 
    "write": 0
   }, 
   {
    "amend": 0, 
    "apply_user_permissions": 0, 
+   "cancel": 0, 
    "create": 1, 
    "delete": 1, 
    "email": 1, 
    "export": 1, 
+   "if_owner": 0, 
    "import": 1, 
    "permlevel": 0, 
    "print": 1, 
@@ -257,5 +496,7 @@
    "write": 1
   }
  ], 
+ "read_only": 0, 
+ "read_only_onload": 0, 
  "search_fields": ""
 }
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/account/account.py b/erpnext/accounts/doctype/account/account.py
index 46f7520..a57cc25 100644
--- a/erpnext/accounts/doctype/account/account.py
+++ b/erpnext/accounts/doctype/account/account.py
@@ -28,6 +28,7 @@
 		self.validate_warehouse_account()
 		self.validate_frozen_accounts_modifier()
 		self.validate_balance_must_be_debit_or_credit()
+		self.validate_account_currency()
 
 	def validate_parent(self):
 		"""Fetch Parent Details and validate parent account"""
@@ -86,6 +87,14 @@
 				frappe.throw(_("Account balance already in Debit, you are not allowed to set 'Balance Must Be' as 'Credit'"))
 			elif account_balance < 0 and self.balance_must_be == "Debit":
 				frappe.throw(_("Account balance already in Credit, you are not allowed to set 'Balance Must Be' as 'Debit'"))
+				
+	def validate_account_currency(self):
+		if not self.currency:
+			self.currency = frappe.db.get_value("Company", self.company, "default_currency")
+			
+		elif self.currency != frappe.db.get_value("Account", self.name, "currency"):
+			if frappe.db.get_value("GL Entry", {"account": self.name}):
+				frappe.throw(_("Currency can not be changed after making entries using some other currency"))
 
 	def convert_group_to_ledger(self):
 		if self.check_if_child_exists():
diff --git a/erpnext/accounts/doctype/gl_entry/gl_entry.json b/erpnext/accounts/doctype/gl_entry/gl_entry.json
index 14b3c58..dfe9fc3 100644
--- a/erpnext/accounts/doctype/gl_entry/gl_entry.json
+++ b/erpnext/accounts/doctype/gl_entry/gl_entry.json
@@ -1,199 +1,475 @@
 {
+ "allow_copy": 0, 
+ "allow_import": 0, 
+ "allow_rename": 0, 
  "autoname": "GL.#######", 
  "creation": "2013-01-10 16:34:06", 
+ "custom": 0, 
  "docstatus": 0, 
  "doctype": "DocType", 
  "fields": [
   {
+   "allow_on_submit": 0, 
    "fieldname": "posting_date", 
    "fieldtype": "Date", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Posting Date", 
+   "no_copy": 0, 
    "oldfieldname": "posting_date", 
    "oldfieldtype": "Date", 
    "permlevel": 0, 
-   "search_index": 1
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 1, 
+   "set_only_once": 0, 
+   "unique": 0
   }, 
   {
+   "allow_on_submit": 0, 
    "fieldname": "transaction_date", 
    "fieldtype": "Date", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Transaction Date", 
+   "no_copy": 0, 
    "oldfieldname": "transaction_date", 
    "oldfieldtype": "Date", 
-   "permlevel": 0
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
   }, 
   {
+   "allow_on_submit": 0, 
    "fieldname": "account", 
    "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Account", 
+   "no_copy": 0, 
    "oldfieldname": "account", 
    "oldfieldtype": "Link", 
    "options": "Account", 
    "permlevel": 0, 
-   "search_index": 1
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 1, 
+   "set_only_once": 0, 
+   "unique": 0
   }, 
   {
+   "allow_on_submit": 0, 
    "fieldname": "party_type", 
    "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
    "label": "Party Type", 
+   "no_copy": 0, 
    "options": "DocType", 
-   "permlevel": 0
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
   }, 
   {
+   "allow_on_submit": 0, 
    "fieldname": "party", 
    "fieldtype": "Dynamic Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
    "label": "Party", 
+   "no_copy": 0, 
    "options": "party_type", 
    "permlevel": 0, 
-   "search_index": 1
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 1, 
+   "set_only_once": 0, 
+   "unique": 0
   }, 
   {
+   "allow_on_submit": 0, 
    "fieldname": "cost_center", 
    "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Cost Center", 
+   "no_copy": 0, 
    "oldfieldname": "cost_center", 
    "oldfieldtype": "Link", 
    "options": "Cost Center", 
    "permlevel": 0, 
-   "search_index": 0
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
   }, 
   {
+   "allow_on_submit": 0, 
    "fieldname": "debit", 
    "fieldtype": "Currency", 
-   "label": "Debit Amt", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Debit Amount", 
+   "no_copy": 0, 
    "oldfieldname": "debit", 
    "oldfieldtype": "Currency", 
    "options": "Company:company:default_currency", 
-   "permlevel": 0
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
   }, 
   {
+   "allow_on_submit": 0, 
    "fieldname": "credit", 
    "fieldtype": "Currency", 
-   "label": "Credit Amt", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Credit Amount", 
+   "no_copy": 0, 
    "oldfieldname": "credit", 
    "oldfieldtype": "Currency", 
    "options": "Company:company:default_currency", 
-   "permlevel": 0
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
   }, 
   {
+   "allow_on_submit": 0, 
+   "fieldname": "currency", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Account Currency", 
+   "no_copy": 0, 
+   "options": "Currency", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "fieldname": "debit_in_account_currency", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Debit Amount in Account Currency", 
+   "no_copy": 0, 
+   "options": "currency", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "fieldname": "credit_in_account_currency", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Credit Amount in Account Currency", 
+   "no_copy": 0, 
+   "options": "currency", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
    "fieldname": "against", 
    "fieldtype": "Text", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
    "in_filter": 1, 
+   "in_list_view": 0, 
    "label": "Against", 
+   "no_copy": 0, 
    "oldfieldname": "against", 
    "oldfieldtype": "Text", 
-   "permlevel": 0
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
   }, 
   {
+   "allow_on_submit": 0, 
    "fieldname": "against_voucher_type", 
    "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
    "in_filter": 0, 
+   "in_list_view": 0, 
    "label": "Against Voucher Type", 
+   "no_copy": 0, 
    "oldfieldname": "against_voucher_type", 
    "oldfieldtype": "Data", 
    "options": "DocType", 
    "permlevel": 0, 
-   "search_index": 0
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
   }, 
   {
+   "allow_on_submit": 0, 
    "fieldname": "against_voucher", 
    "fieldtype": "Dynamic Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
    "in_filter": 1, 
+   "in_list_view": 0, 
    "label": "Against Voucher", 
+   "no_copy": 0, 
    "oldfieldname": "against_voucher", 
    "oldfieldtype": "Data", 
    "options": "against_voucher_type", 
    "permlevel": 0, 
-   "search_index": 0
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
   }, 
   {
+   "allow_on_submit": 0, 
    "fieldname": "voucher_type", 
    "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
    "in_filter": 1, 
+   "in_list_view": 0, 
    "label": "Voucher Type", 
+   "no_copy": 0, 
    "oldfieldname": "voucher_type", 
    "oldfieldtype": "Select", 
    "options": "DocType", 
    "permlevel": 0, 
-   "search_index": 0
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
   }, 
   {
+   "allow_on_submit": 0, 
    "fieldname": "voucher_no", 
    "fieldtype": "Dynamic Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
    "in_filter": 1, 
+   "in_list_view": 0, 
    "label": "Voucher No", 
+   "no_copy": 0, 
    "oldfieldname": "voucher_no", 
    "oldfieldtype": "Data", 
    "options": "voucher_type", 
    "permlevel": 0, 
-   "search_index": 1
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 1, 
+   "set_only_once": 0, 
+   "unique": 0
   }, 
   {
+   "allow_on_submit": 0, 
    "fieldname": "remarks", 
    "fieldtype": "Text", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
    "in_filter": 1, 
+   "in_list_view": 0, 
    "label": "Remarks", 
    "no_copy": 1, 
    "oldfieldname": "remarks", 
    "oldfieldtype": "Text", 
    "permlevel": 0, 
-   "search_index": 0
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
   }, 
   {
+   "allow_on_submit": 0, 
    "fieldname": "is_opening", 
    "fieldtype": "Select", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
    "in_filter": 1, 
+   "in_list_view": 0, 
    "label": "Is Opening", 
+   "no_copy": 0, 
    "oldfieldname": "is_opening", 
    "oldfieldtype": "Select", 
    "options": "No\nYes", 
    "permlevel": 0, 
-   "search_index": 0
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
   }, 
   {
+   "allow_on_submit": 0, 
    "fieldname": "is_advance", 
    "fieldtype": "Select", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
    "in_filter": 0, 
+   "in_list_view": 0, 
    "label": "Is Advance", 
+   "no_copy": 0, 
    "oldfieldname": "is_advance", 
    "oldfieldtype": "Select", 
    "options": "No\nYes", 
    "permlevel": 0, 
-   "search_index": 0
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
   }, 
   {
+   "allow_on_submit": 0, 
    "fieldname": "fiscal_year", 
    "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
    "in_filter": 1, 
+   "in_list_view": 0, 
    "label": "Fiscal Year", 
+   "no_copy": 0, 
    "oldfieldname": "fiscal_year", 
    "oldfieldtype": "Select", 
    "options": "Fiscal Year", 
    "permlevel": 0, 
-   "search_index": 0
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
   }, 
   {
+   "allow_on_submit": 0, 
    "fieldname": "company", 
    "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
    "in_filter": 1, 
+   "in_list_view": 0, 
    "label": "Company", 
+   "no_copy": 0, 
    "oldfieldname": "company", 
    "oldfieldtype": "Link", 
    "options": "Company", 
    "permlevel": 0, 
-   "search_index": 0
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
   }
  ], 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
  "icon": "icon-list", 
  "idx": 1, 
  "in_create": 1, 
- "modified": "2015-07-09 15:51:04.986518", 
+ "in_dialog": 0, 
+ "is_submittable": 0, 
+ "issingle": 0, 
+ "istable": 0, 
+ "modified": "2015-08-18 14:25:44.430671", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "GL Entry", 
@@ -202,44 +478,66 @@
   {
    "amend": 0, 
    "apply_user_permissions": 1, 
+   "cancel": 0, 
    "create": 0, 
+   "delete": 0, 
    "email": 1, 
    "export": 1, 
+   "if_owner": 0, 
+   "import": 0, 
    "permlevel": 0, 
    "print": 1, 
    "read": 1, 
    "report": 1, 
    "role": "Accounts User", 
+   "set_user_permissions": 0, 
+   "share": 0, 
    "submit": 0, 
    "write": 0
   }, 
   {
    "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
    "create": 0, 
+   "delete": 0, 
    "email": 1, 
    "export": 1, 
+   "if_owner": 0, 
+   "import": 0, 
    "permlevel": 0, 
    "print": 1, 
    "read": 1, 
    "report": 1, 
    "role": "Accounts Manager", 
+   "set_user_permissions": 0, 
+   "share": 0, 
    "submit": 0, 
    "write": 0
   }, 
   {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
    "create": 0, 
    "delete": 0, 
    "email": 0, 
    "export": 1, 
+   "if_owner": 0, 
+   "import": 0, 
    "permlevel": 0, 
    "print": 0, 
    "read": 1, 
    "report": 1, 
    "role": "Auditor", 
+   "set_user_permissions": 0, 
    "share": 0, 
+   "submit": 0, 
    "write": 0
   }
  ], 
+ "read_only": 0, 
+ "read_only_onload": 0, 
  "search_fields": "voucher_no,account,posting_date,against_voucher", 
  "sort_field": "modified", 
  "sort_order": "DESC"
diff --git a/erpnext/accounts/doctype/gl_entry/gl_entry.py b/erpnext/accounts/doctype/gl_entry/gl_entry.py
index 43c4213..b37b404 100644
--- a/erpnext/accounts/doctype/gl_entry/gl_entry.py
+++ b/erpnext/accounts/doctype/gl_entry/gl_entry.py
@@ -20,6 +20,7 @@
 		self.check_pl_account()
 		self.validate_cost_center()
 		self.validate_party()
+		self.validate_currency()
 
 	def on_update_with_args(self, adv_adj, update_outstanding = 'Yes'):
 		self.validate_account_details(adv_adj)
@@ -98,6 +99,30 @@
 			if not frozen_accounts_modifier in frappe.get_roles():
 				if frappe.db.get_value(self.party_type, self.party, "is_frozen"):
 					frappe.throw("{0} {1} is frozen".format(self.party_type, self.party), CustomerFrozen)
+					
+	def validate_currency(self):
+		company_currency = frappe.db.get_value("Company", self.company, "default_currency")
+		account_currency = frappe.db.get_value("Account", self.account, "currency") or company_currency
+
+		if not self.currency:
+			self.currency = company_currency
+		if account_currency != self.currency:
+			frappe.throw(_("Accounting Entry for {0} can only be made in currency: {1}")
+				.format(self.account, (account_currency or company_currency)))
+				
+		if self.party_type and self.party:
+			existing_gle = frappe.db.get_value("GL Entry", {"party_type": self.party_type, 
+				"party": self.party, "company": self.company}, ["name", "currency"], as_dict=1)
+			if not existing_gle:
+				party_currency = frappe.db.get_value(self.party_type, self.party, "default_currency") or company_currency
+				if party_currency != account_currency:
+					frappe.throw(_("Invalid Account {0}. Account Currency must be {1}, same as {2}: {3}")
+						.format(self.account, party_currency, self.party_type, self.party))
+			else:
+				currency_in_existing_entries = existing_gle.currency or company_currency
+				if currency_in_existing_entries != self.currency:
+					frappe.throw(_("Accounting Entry for {0}: {1} can only be made in currency: {2}")
+						.format(self.party_type, self.party, currency_in_existing_entries))
 
 def validate_balance_type(account, adv_adj=False):
 	if not adv_adj and account:
diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.js b/erpnext/accounts/doctype/journal_entry/journal_entry.js
index ff1ace4..e0d580c 100644
--- a/erpnext/accounts/doctype/journal_entry/journal_entry.js
+++ b/erpnext/accounts/doctype/journal_entry/journal_entry.js
@@ -2,8 +2,42 @@
 // License: GNU General Public License v3. See license.txt
 
 frappe.provide("erpnext.accounts");
+frappe.provide("erpnext.journal_entry");
 frappe.require("assets/erpnext/js/utils.js");
 
+frappe.ui.form.on("Journal Entry", {
+	refresh: function(frm) {
+		erpnext.toggle_naming_series();
+		cur_frm.cscript.voucher_type(frm.doc);
+
+		if(frm.doc.docstatus==1) {
+			cur_frm.add_custom_button(__('View Ledger'), function() {
+				frappe.route_options = {
+					"voucher_no": frm.doc.name,
+					"from_date": frm.doc.posting_date,
+					"to_date": frm.doc.posting_date,
+					"company": frm.doc.company,
+					group_by_voucher: 0
+				};
+				frappe.set_route("query-report", "General Ledger");
+			}, "icon-table");
+		}
+		
+		// hide /unhide fields based on currency
+		erpnext.journal_entry.toggle_fields_based_on_currency(frm);
+	}
+})
+
+erpnext.journal_entry.toggle_fields_based_on_currency = function(frm) {
+	var fields = ["balance_in_account_currency", "party_balance_in_account_currency", 
+		"debit_in_account_currency", "credit_in_account_currency"];
+		
+	var company_currency = erpnext.get_currency(frm.doc.company);
+		
+	var grid = frm.get_field("accounts").grid;
+	grid.set_column_disp(fields, grid.currency!=company_currency);
+}
+
 erpnext.accounts.JournalEntry = frappe.ui.form.Controller.extend({
 	onload: function() {
 		this.load_defaults();
@@ -153,8 +187,10 @@
 		// set difference
 		if(doc.difference) {
 			if(doc.difference > 0) {
+				row.credit_in_account_currency = doc.difference;
 				row.credit = doc.difference;
 			} else {
+				row.debit_in_account_currency = -doc.difference;
 				row.debit = -doc.difference;
 			}
 		}
@@ -164,24 +200,6 @@
 
 cur_frm.script_manager.make(erpnext.accounts.JournalEntry);
 
-cur_frm.cscript.refresh = function(doc) {
-	erpnext.toggle_naming_series();
-	cur_frm.cscript.voucher_type(doc);
-
-	if(doc.docstatus==1) {
-		cur_frm.add_custom_button(__('View Ledger'), function() {
-			frappe.route_options = {
-				"voucher_no": doc.name,
-				"from_date": doc.posting_date,
-				"to_date": doc.posting_date,
-				"company": doc.company,
-				group_by_voucher: 0
-			};
-			frappe.set_route("query-report", "General Ledger");
-		}, "icon-table");
-	}
-}
-
 cur_frm.cscript.company = function(doc, cdt, cdn) {
 	cur_frm.refresh_fields();
 	erpnext.get_fiscal_year(doc.company, doc.posting_date);
@@ -193,10 +211,10 @@
 
 cur_frm.cscript.update_totals = function(doc) {
 	var td=0.0; var tc =0.0;
-	var el = doc.accounts || [];
-	for(var i in el) {
-		td += flt(el[i].debit, precision("debit", el[i]));
-		tc += flt(el[i].credit, precision("credit", el[i]));
+	var accounts = doc.accounts || [];
+	for(var i in accounts) {
+		td += flt(accounts[i].debit, precision("debit", accounts[i]));
+		tc += flt(accounts[i].credit, precision("credit", accounts[i]));
 	}
 	var doc = locals[doc.doctype][doc.name];
 	doc.total_debit = td;
@@ -205,32 +223,12 @@
 	refresh_many(['total_debit','total_credit','difference']);
 }
 
-cur_frm.cscript.debit = function(doc,dt,dn) { cur_frm.cscript.update_totals(doc); }
-cur_frm.cscript.credit = function(doc,dt,dn) { cur_frm.cscript.update_totals(doc); }
-
 cur_frm.cscript.get_balance = function(doc,dt,dn) {
 	cur_frm.cscript.update_totals(doc);
 	return $c_obj(cur_frm.doc, 'get_balance', '', function(r, rt){
 	cur_frm.refresh();
 	});
 }
-// Get balance
-// -----------
-
-cur_frm.cscript.account = function(doc,dt,dn) {
-	var d = locals[dt][dn];
-	if(d.account) {
-		return frappe.call({
-			method: "erpnext.accounts.doctype.journal_entry.journal_entry.get_account_balance_and_party_type",
-			args: {account: d.account, date: doc.posting_date},
-			callback: function(r) {
-				$.extend(d, r.message);
-				refresh_field('balance', d.name, 'accounts');
-				refresh_field('party_type', d.name, 'accounts');
-			}
-		});
-	}
-}
 
 cur_frm.cscript.validate = function(doc,cdt,cdn) {
 	cur_frm.cscript.update_totals(doc);
@@ -295,22 +293,77 @@
 	}
 }
 
-frappe.ui.form.on("Journal Entry Account", "party", function(frm, cdt, cdn) {
-	var d = frappe.get_doc(cdt, cdn);
-	if(!d.account && d.party_type && d.party) {
-		return frm.call({
-			method: "erpnext.accounts.doctype.journal_entry.journal_entry.get_party_account_and_balance",
-			child: d,
-			args: {
-				company: frm.doc.company,
-				party_type: d.party_type,
-				party: d.party
-			}
-		});
+frappe.ui.form.on("Journal Entry Account", {
+	party: function(frm, cdt, cdn) {
+		var d = frappe.get_doc(cdt, cdn);
+		if(!d.account && d.party_type && d.party) {
+			return frm.call({
+				method: "erpnext.accounts.doctype.journal_entry.journal_entry.get_party_account_and_balance",
+				child: d,
+				args: {
+					company: frm.doc.company,
+					party_type: d.party_type,
+					party: d.party
+				}
+			});
+		}
+	},
+	
+	account: function(frm, dt, dn) {
+		var d = locals[dt][dn];
+		if(d.account) {
+			return frappe.call({
+				method: "erpnext.accounts.doctype.journal_entry.journal_entry.get_account_balance_and_party_type",
+				args: {
+					account: d.account, 
+					date: frm.doc.posting_date,
+					company: frm.doc.company
+				},
+				callback: function(r) {
+					if(r.message) {
+						$.extend(d, r.message[0]);
+						refresh_field('balance', d.name, 'accounts');
+						refresh_field('party_type', d.name, 'accounts');
+						refresh_field('currency', d.name, 'accounts');
+						
+						if(r.message[1] && (!frm.doc.exchange_rate || frm.doc.exchange_rate == 1.0)) {
+							frm.set_value("exchange_rate", r.message[1])
+						}
+					}
+				}
+			});
+		}
+	},
+	
+	debit_in_account_currency: function(frm, dt, dn) {
+		var company_currency = erpnext.get_currency(frm.doc.company);
+		var row = locals[dt][dn];
+		
+		var exchange_rate = (row.currency==company_currency) ? 1 : frm.doc.exchange_rate;
+		
+		frappe.model.set_value(dt, dn, "debit", 
+			flt(flt(row.debit_in_account_currency)*exchange_rate), precision("debit", row));
+	},
+	
+	credit_in_account_currency: function(frm, dt, dn) {
+		var company_currency = erpnext.get_currency(frm.doc.company);
+		var row = locals[dt][dn];
+		
+		var exchange_rate = (row.currency==company_currency) ? 1 : frm.doc.exchange_rate;
+		
+		frappe.model.set_value(dt, dn, "credit", 
+			flt(flt(row.credit_in_account_currency)*exchange_rate), precision("credit", row));
+	},
+	
+	debit: function(frm, dt, dn) {
+		cur_frm.cscript.update_totals(frm.doc);
+	},
+	
+	credit: function(frm, dt, dn) {
+		cur_frm.cscript.update_totals(frm.doc);
 	}
 })
 
 frappe.ui.form.on("Journal Entry Account", "accounts_remove", function(frm) {
 	cur_frm.cscript.update_totals(frm.doc);
-});
-
+});
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py
index f5f22dc..d61e63a 100644
--- a/erpnext/accounts/doctype/journal_entry/journal_entry.py
+++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py
@@ -5,7 +5,7 @@
 import frappe
 from frappe.utils import cstr, flt, fmt_money, formatdate, getdate, date_diff
 from frappe import msgprint, _, scrub
-from erpnext.setup.utils import get_company_currency
+from erpnext.setup.utils import get_company_currency, get_exchange_rate
 from erpnext.controllers.accounts_controller import AccountsController
 from erpnext.accounts.utils import get_balance_on
 
@@ -26,6 +26,7 @@
 		self.validate_party()
 		self.validate_cheque_info()
 		self.validate_entries_for_advance()
+		self.validate_multi_currency()
 		self.validate_debit_and_credit()
 		self.validate_against_jv()
 		self.validate_reference_doc()
@@ -242,15 +243,37 @@
 			if d.debit and d.credit:
 				frappe.throw(_("You cannot credit and debit same account at the same time"))
 
-			self.total_debit = flt(self.total_debit) + flt(d.debit, self.precision("debit", "accounts"))
-			self.total_credit = flt(self.total_credit) + flt(d.credit, self.precision("credit", "accounts"))
+			self.total_debit = flt(self.total_debit) + flt(d.debit, d.precision("debit"))
+			self.total_credit = flt(self.total_credit) + flt(d.credit, d.precision("credit"))
 
 		self.difference = flt(self.total_debit, self.precision("total_debit")) - \
 			flt(self.total_credit, self.precision("total_credit"))
-
+		print self.difference
 		if self.difference:
 			frappe.throw(_("Total Debit must be equal to Total Credit. The difference is {0}")
 				.format(self.difference))
+				
+	def validate_multi_currency(self):
+		alternate_currency = [d.currency for d in self.get("accounts") if d.currency!=self.company_currency]
+			
+		if alternate_currency:
+			if not self.exchange_rate:
+				frappe.throw(_("Exchange Rate is mandatory in multi-currency Journal Entry"))
+				
+			if len(alternate_currency) > 1:
+				frappe.throw(_("Only one alternate currency can be used in a single Journal Entry"))
+		else:
+			self.exchange_rate = 1.0
+			
+		for d in self.get("accounts"):
+			if not d.currency:
+				d.currency = frappe.db.get_value("Account", d.account, "currency") or self.company_currency
+				
+			exchange_rate = self.exchange_rate if d.currency != self.company_currency else 1
+			
+			d.debit = flt(flt(d.debit_in_account_currency)*exchange_rate, d.precision("debit"))
+			d.credit = flt(flt(d.credit_in_account_currency)*exchange_rate, d.precision("credit"))
+		
 
 	def create_remarks(self):
 		r = []
@@ -260,15 +283,13 @@
 			else:
 				msgprint(_("Please enter Reference date"), raise_exception=frappe.MandatoryError)
 
-		company_currency = get_company_currency(self.company)
-
 		for d in self.get('accounts'):
 			if d.reference_type=="Sales Invoice" and d.credit:
-				r.append(_("{0} against Sales Invoice {1}").format(fmt_money(flt(d.credit), currency = company_currency), \
+				r.append(_("{0} against Sales Invoice {1}").format(fmt_money(flt(d.credit), currency = self.company_currency), \
 					d.reference_name))
 
 			if d.reference_type=="Sales Order" and d.credit:
-				r.append(_("{0} against Sales Order {1}").format(fmt_money(flt(d.credit), currency = company_currency), \
+				r.append(_("{0} against Sales Order {1}").format(fmt_money(flt(d.credit), currency = self.company_currency), \
 					d.reference_name))
 
 			if d.reference_type == "Purchase Invoice" and d.debit:
@@ -276,11 +297,11 @@
 					from `tabPurchase Invoice` where name=%s""", d.reference_name)
 				if bill_no and bill_no[0][0] and bill_no[0][0].lower().strip() \
 						not in ['na', 'not applicable', 'none']:
-					r.append(_('{0} against Bill {1} dated {2}').format(fmt_money(flt(d.debit), currency=company_currency), bill_no[0][0],
+					r.append(_('{0} against Bill {1} dated {2}').format(fmt_money(flt(d.debit), currency=self.company_currency), bill_no[0][0],
 						bill_no[0][1] and formatdate(bill_no[0][1].strftime('%Y-%m-%d'))))
 
 			if d.reference_type == "Purchase Order" and d.debit:
-				r.append(_("{0} against Purchase Order {1}").format(fmt_money(flt(d.credit), currency = company_currency), \
+				r.append(_("{0} against Purchase Order {1}").format(fmt_money(flt(d.credit), currency = self.company_currency), \
 					d.reference_name))
 
 		if self.user_remark:
@@ -301,10 +322,9 @@
 				self.set_total_amount(d.debit or d.credit)
 
 	def set_total_amount(self, amt):
-		company_currency = get_company_currency(self.company)
 		self.total_amount = amt
 		from frappe.utils import money_in_words
-		self.total_amount_in_words = money_in_words(amt, company_currency)
+		self.total_amount_in_words = money_in_words(amt, self.company_currency)
 
 	def make_gl_entries(self, cancel=0, adv_adj=0):
 		from erpnext.accounts.general_ledger import make_gl_entries
@@ -318,8 +338,11 @@
 						"party_type": d.party_type,
 						"party": d.party,
 						"against": d.against_account,
-						"debit": flt(d.debit, self.precision("debit", "accounts")),
-						"credit": flt(d.credit, self.precision("credit", "accounts")),
+						"debit": flt(d.debit, d.precision("debit")),
+						"credit": flt(d.credit, d.precision("credit")),
+						"currency": d.currency,
+						"debit_in_account_currency": flt(d.debit_in_account_currency, d.precision("debit_in_account_currency")),
+						"credit_in_account_currency": flt(d.credit_in_account_currency, d.precision("credit_in_account_currency")),
 						"against_voucher_type": d.reference_type,
 						"against_voucher": d.reference_name,
 						"remarks": self.remark,
@@ -640,14 +663,28 @@
 	}
 
 @frappe.whitelist()
-def get_account_balance_and_party_type(account, date):
+def get_account_balance_and_party_type(account, date, company):
 	"""Returns dict of account balance and party type to be set in Journal Entry on selection of account."""
 	if not frappe.has_permission("Account"):
 		frappe.msgprint(_("No Permission"), raise_exception=1)
 
-	account_type = frappe.db.get_value("Account", account, "account_type")
-	return {
+	company_currency = get_company_currency(company)
+	account_details = frappe.db.get_value("Account", account, ["account_type", "currency"], as_dict=1)
+	
+	if account_details.account_type == "Receivable":
+		party_type = "Customer"
+	elif account_details.account_type == "Payable":
+		party_type = "Supplier"
+	else:
+		party_type = ""
+		
+	exchange_rate = None
+	if account_details.currency != company_currency:
+		exchange_rate = get_exchange_rate(account_details.currency, company_currency)
+		
+	grid_values = {
 		"balance": get_balance_on(account, date),
-		"party_type": {"Receivable":"Customer", "Payable":"Supplier"}.get(account_type, "")
+		"party_type": party_type,
+		"currency": account_details.currency or company_currency,
 	}
-
+	return grid_values, exchange_rate
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/journal_entry_account/journal_entry_account.json b/erpnext/accounts/doctype/journal_entry_account/journal_entry_account.json
index 77a0457..718d96a 100644
--- a/erpnext/accounts/doctype/journal_entry_account/journal_entry_account.json
+++ b/erpnext/accounts/doctype/journal_entry_account/journal_entry_account.json
@@ -34,6 +34,27 @@
   }, 
   {
    "allow_on_submit": 0, 
+   "fieldname": "currency", 
+   "fieldtype": "Link", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Currency", 
+   "no_copy": 0, 
+   "options": "Currency", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
    "fieldname": "balance", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -56,6 +77,27 @@
   }, 
   {
    "allow_on_submit": 0, 
+   "fieldname": "balance_in_account_currency", 
+   "fieldtype": "Currency", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Balance in Account Currency", 
+   "no_copy": 0, 
+   "options": "currency", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
    "default": ":Company", 
    "description": "If Income or Expense", 
    "fieldname": "cost_center", 
@@ -161,6 +203,27 @@
   }, 
   {
    "allow_on_submit": 0, 
+   "fieldname": "party_balance_in_account_currency", 
+   "fieldtype": "Currency", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Party Balance in Account Currency", 
+   "no_copy": 0, 
+   "options": "currency", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
    "fieldname": "sec_break1", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -180,20 +243,41 @@
   }, 
   {
    "allow_on_submit": 0, 
+   "fieldname": "debit_in_account_currency", 
+   "fieldtype": "Currency", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Debit in Account Currency", 
+   "no_copy": 0, 
+   "options": "currency", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
    "fieldname": "debit", 
    "fieldtype": "Currency", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
-   "label": "Debit", 
+   "label": "Debit in Company Currency", 
    "no_copy": 0, 
    "oldfieldname": "debit", 
    "oldfieldtype": "Currency", 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
    "print_hide": 0, 
-   "read_only": 0, 
+   "read_only": 1, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 0, 
@@ -220,20 +304,41 @@
   }, 
   {
    "allow_on_submit": 0, 
+   "fieldname": "credit_in_account_currency", 
+   "fieldtype": "Currency", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Credit in Account Currency", 
+   "no_copy": 0, 
+   "options": "currency", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
    "fieldname": "credit", 
    "fieldtype": "Currency", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
-   "label": "Credit", 
+   "label": "Credit in Company Currency", 
    "no_copy": 0, 
    "oldfieldname": "credit", 
    "oldfieldtype": "Currency", 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
    "print_hide": 0, 
-   "read_only": 0, 
+   "read_only": 1, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 0, 
@@ -371,7 +476,7 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-08-17 02:11:33.991361", 
+ "modified": "2015-08-27 12:52:20.914258", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Journal Entry Account", 
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
index 70ebee1..e0a8245 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
@@ -75,8 +75,29 @@
 			me.apply_pricing_rule();
 		})
 	},
+	
+	credit_to: function() {
+		var me = this;
+		if(this.frm.doc.credit_to) {
+			me.frm.call({
+				method: "frappe.client.get_value",
+				args: {
+					doctype: "Account",
+					fieldname: "currency",
+					filters: { name: me.frm.doc.credit_to },
+				},
+				callback: function(r, rt) {
+					if(r.message) {
+						me.frm.set_value("party_account_currency", r.message.currency);
+						me.set_dynamic_labels();
+					}
+				}
+			});
+		}
+	},
 
 	write_off_amount: function() {
+		this.set_in_company_currency(this.frm.doc, ["write_off_amount"]);
 		this.calculate_outstanding_amount();
 		this.frm.refresh_fields();
 	},
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
index a43e553..1a59135 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
@@ -248,7 +248,7 @@
 		expenses_included_in_valuation = self.get_company_default("expenses_included_in_valuation")
 
 		gl_entries = []
-
+		
 		# parent's gl entry
 		if self.base_grand_total:
 			gl_entries.append(
@@ -257,26 +257,32 @@
 					"party_type": "Supplier",
 					"party": self.supplier,
 					"against": self.against_expense_account,
-					"credit": self.total_amount_to_pay,
-					"remarks": self.remarks,
+					"credit": self.base_grand_total,
+					"credit_in_account_currency": self.base_grand_total \
+						if self.party_account_currency==self.company_currency else self.grand_total,
 					"against_voucher": self.return_against if cint(self.is_return) else self.name,
 					"against_voucher_type": self.doctype,
-				})
+				}, self.party_account_currency)
 			)
 
 		# tax table gl entries
 		valuation_tax = {}
 		for tax in self.get("taxes"):
 			if tax.category in ("Total", "Valuation and Total") and flt(tax.base_tax_amount_after_discount_amount):
+				account_currency = frappe.db.get_value("Account", tax.account_head, "currency")
+				
+				dr_or_cr = "debit" if tax.add_deduct_tax == "Add" else "credit"
+				
 				gl_entries.append(
 					self.get_gl_dict({
 						"account": tax.account_head,
 						"against": self.supplier,
-						"debit": tax.add_deduct_tax == "Add" and tax.base_tax_amount_after_discount_amount or 0,
-						"credit": tax.add_deduct_tax == "Deduct" and tax.base_tax_amount_after_discount_amount or 0,
-						"remarks": self.remarks,
+						dr_or_cr: tax.base_tax_amount_after_discount_amount,
+						dr_or_cr + "_in_account_currency": tax.base_tax_amount_after_discount_amount \
+							if account_currency==self.company_currency \
+							else tax.tax_amount_after_discount_amount,
 						"cost_center": tax.cost_center
-					})
+					}, account_currency)
 				)
 
 			# accumulate valuation tax
@@ -292,14 +298,16 @@
 		stock_items = self.get_stock_items()
 		for item in self.get("items"):
 			if flt(item.base_net_amount):
+				account_currency = frappe.db.get_value("Account", item.expense_account, "currency")
 				gl_entries.append(
 					self.get_gl_dict({
 						"account": item.expense_account,
 						"against": self.supplier,
 						"debit": item.base_net_amount,
-						"remarks": self.remarks,
+						"debit_in_account_currency": item.base_net_amount \
+							if account_currency==self.company_currency else item.net_amount,
 						"cost_center": item.cost_center
-					})
+					}, account_currency)
 				)
 
 			if auto_accounting_for_stock and self.is_opening == "No" and \
@@ -352,12 +360,28 @@
 		# writeoff account includes petty difference in the invoice amount
 		# and the amount that is paid
 		if self.write_off_account and flt(self.write_off_amount):
+			write_off_account_currency = frappe.db.get_value("Account", self.write_off_account, "currency")
+			
+			gl_entries.append(
+				self.get_gl_dict({
+					"account": self.credit_to,
+					"party_type": "Supplier",
+					"party": self.supplier,
+					"against": self.write_off_account,
+					"debit": self.base_write_off_amount,
+					"debit_in_account_currency": self.base_write_off_amount \
+						if self.party_account_currency==self.company_currency else self.write_off_amount,
+					"against_voucher": self.return_against if cint(self.is_return) else self.name,
+					"against_voucher_type": self.doctype,
+				}, self.party_account_currency)
+			)
 			gl_entries.append(
 				self.get_gl_dict({
 					"account": self.write_off_account,
 					"against": self.supplier,
-					"credit": flt(self.write_off_amount),
-					"remarks": self.remarks,
+					"credit": flt(self.base_write_off_amount),
+					"credit_in_account_currency": self.base_write_off_amount \
+						if write_off_account_currency==self.company_currency else self.write_off_amount,
 					"cost_center": self.write_off_cost_center
 				})
 			)
diff --git a/erpnext/accounts/doctype/purchase_invoice_advance/purchase_invoice_advance.json b/erpnext/accounts/doctype/purchase_invoice_advance/purchase_invoice_advance.json
index ec73ad4..49540b7 100644
--- a/erpnext/accounts/doctype/purchase_invoice_advance/purchase_invoice_advance.json
+++ b/erpnext/accounts/doctype/purchase_invoice_advance/purchase_invoice_advance.json
@@ -1,89 +1,163 @@
 {
- "creation": "2013-03-08 15:36:46",
- "docstatus": 0,
- "doctype": "DocType",
+ "allow_copy": 0, 
+ "allow_import": 0, 
+ "allow_rename": 0, 
+ "creation": "2013-03-08 15:36:46", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
  "fields": [
   {
-   "fieldname": "journal_entry",
-   "fieldtype": "Link",
-   "in_list_view": 1,
-   "label": "Journal Entry",
-   "no_copy": 1,
-   "oldfieldname": "journal_voucher",
-   "oldfieldtype": "Link",
-   "options": "Journal Entry",
-   "permlevel": 0,
-   "print_width": "180px",
-   "read_only": 1,
+   "allow_on_submit": 0, 
+   "fieldname": "journal_entry", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 1, 
+   "label": "Journal Entry", 
+   "no_copy": 1, 
+   "oldfieldname": "journal_voucher", 
+   "oldfieldtype": "Link", 
+   "options": "Journal Entry", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_width": "180px", 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0, 
    "width": "180px"
-  },
+  }, 
   {
-   "fieldname": "jv_detail_no",
-   "fieldtype": "Data",
-   "hidden": 1,
-   "in_list_view": 0,
-   "label": "Journal Entry Detail No",
-   "no_copy": 1,
-   "oldfieldname": "jv_detail_no",
-   "oldfieldtype": "Date",
-   "permlevel": 0,
-   "print_hide": 1,
-   "print_width": "80px",
-   "read_only": 1,
+   "allow_on_submit": 0, 
+   "fieldname": "jv_detail_no", 
+   "fieldtype": "Data", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Journal Entry Detail No", 
+   "no_copy": 1, 
+   "oldfieldname": "jv_detail_no", 
+   "oldfieldtype": "Date", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "print_width": "80px", 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0, 
    "width": "80px"
-  },
+  }, 
   {
-   "fieldname": "remarks",
-   "fieldtype": "Small Text",
-   "in_list_view": 1,
-   "label": "Remarks",
-   "no_copy": 1,
-   "oldfieldname": "remarks",
-   "oldfieldtype": "Small Text",
-   "permlevel": 0,
-   "print_width": "150px",
-   "read_only": 1,
+   "allow_on_submit": 0, 
+   "fieldname": "remarks", 
+   "fieldtype": "Small Text", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 1, 
+   "label": "Remarks", 
+   "no_copy": 1, 
+   "oldfieldname": "remarks", 
+   "oldfieldtype": "Small Text", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_width": "150px", 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0, 
    "width": "150px"
-  },
+  }, 
   {
-   "fieldname": "col_break1",
-   "fieldtype": "Column Break",
-   "permlevel": 0
-  },
+   "allow_on_submit": 0, 
+   "fieldname": "col_break1", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
   {
-   "fieldname": "advance_amount",
-   "fieldtype": "Currency",
-   "in_list_view": 1,
-   "label": "Advance Amount",
-   "no_copy": 1,
-   "oldfieldname": "advance_amount",
-   "oldfieldtype": "Currency",
-   "options": "Company:company:default_currency",
-   "permlevel": 0,
-   "print_width": "100px",
-   "read_only": 1,
+   "allow_on_submit": 0, 
+   "fieldname": "advance_amount", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 1, 
+   "label": "Advance Amount", 
+   "no_copy": 1, 
+   "oldfieldname": "advance_amount", 
+   "oldfieldtype": "Currency", 
+   "options": "party_account_currency", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_width": "100px", 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0, 
    "width": "100px"
-  },
+  }, 
   {
-   "fieldname": "allocated_amount",
-   "fieldtype": "Currency",
-   "in_list_view": 1,
-   "label": "Allocated Amount",
-   "no_copy": 1,
-   "oldfieldname": "allocated_amount",
-   "oldfieldtype": "Currency",
-   "options": "Company:company:default_currency",
-   "permlevel": 0,
-   "print_width": "100px",
+   "allow_on_submit": 0, 
+   "fieldname": "allocated_amount", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 1, 
+   "label": "Allocated Amount", 
+   "no_copy": 1, 
+   "oldfieldname": "allocated_amount", 
+   "oldfieldtype": "Currency", 
+   "options": "party_account_currency", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_width": "100px", 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0, 
    "width": "100px"
   }
- ],
- "idx": 1,
- "istable": 1,
- "modified": "2014-12-25 16:29:15.176476",
- "modified_by": "Administrator",
- "module": "Accounts",
- "name": "Purchase Invoice Advance",
- "owner": "Administrator",
- "permissions": []
-}
+ ], 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "idx": 1, 
+ "in_create": 0, 
+ "in_dialog": 0, 
+ "is_submittable": 0, 
+ "issingle": 0, 
+ "istable": 1, 
+ "modified": "2015-08-25 17:51:30.274069", 
+ "modified_by": "nabin@erpnext.com", 
+ "module": "Accounts", 
+ "name": "Purchase Invoice Advance", 
+ "owner": "Administrator", 
+ "permissions": [], 
+ "read_only": 0, 
+ "read_only_onload": 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 ec84302..1d44e54 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
@@ -175,6 +175,26 @@
 			me.apply_pricing_rule();
 		})
 	},
+	
+	debit_to: function() {
+		var me = this;
+		if(this.frm.doc.debit_to) {
+			me.frm.call({
+				method: "frappe.client.get_value",
+				args: {
+					doctype: "Account",
+					fieldname: "currency",
+					filters: { name: me.frm.doc.debit_to },
+				},
+				callback: function(r, rt) {
+					if(r.message) {
+						me.frm.set_value("party_account_currency", r.message.currency);
+						me.set_dynamic_labels();
+					}
+				}
+			});
+		}		
+	},
 
 	allocated_amount: function() {
 		this.calculate_total_advance();
@@ -183,10 +203,10 @@
 
 	write_off_outstanding_amount_automatically: function() {
 		if(cint(this.frm.doc.write_off_outstanding_amount_automatically)) {
-			frappe.model.round_floats_in(this.frm.doc, ["base_grand_total", "paid_amount"]);
+			frappe.model.round_floats_in(this.frm.doc, ["grand_total", "paid_amount"]);
 			// this will make outstanding amount 0
 			this.frm.set_value("write_off_amount",
-				flt(this.frm.doc.base_grand_total - this.frm.doc.paid_amount - this.frm.doc.total_advance, precision("write_off_amount"))
+				flt(this.frm.doc.grand_total - this.frm.doc.paid_amount - this.frm.doc.total_advance, precision("write_off_amount"))
 			);
 			this.frm.toggle_enable("write_off_amount", false);
 
@@ -199,10 +219,12 @@
 	},
 
 	write_off_amount: function() {
+		this.set_in_company_currency(this.frm.doc, ["write_off_amount"]);
 		this.write_off_outstanding_amount_automatically();
 	},
 
 	paid_amount: function() {
+		this.set_in_company_currency(this.frm.doc, ["paid_amount"]);
 		this.write_off_outstanding_amount_automatically();
 	},
 
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
index 92e3c0d..9639038 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -423,14 +423,21 @@
 		if cint(self.is_pos) == 1:
 			if flt(self.paid_amount) == 0:
 				if self.cash_bank_account:
-					frappe.db.set(self, 'paid_amount',
-						(flt(self.base_grand_total) - flt(self.write_off_amount)))
+					paid_amount = flt(flt(self.grand_total) - flt(self.write_off_amount), 
+						self.precision("paid_amount"))
+					base_paid_amount = flt(paid_amount*self.conversion_rate, self.precision("base_paid_amount"))
+					
+					frappe.db.set(self, 'paid_amount', paid_amount)
+					frappe.db.set(self, 'base_paid_amount', base_paid_amount)
+					
 				else:
 					# show message that the amount is not paid
 					frappe.db.set(self,'paid_amount',0)
+					frappe.db.set(self,'base_paid_amount',0)
 					frappe.msgprint(_("Note: Payment Entry will not be created since 'Cash or Bank Account' was not specified"))
 		else:
 			frappe.db.set(self,'paid_amount',0)
+			frappe.db.set(self,'base_paid_amount',0)
 
 	def check_prev_docstatus(self):
 		for d in self.get('items'):
@@ -470,7 +477,7 @@
 		from erpnext.accounts.general_ledger import merge_similar_entries
 
 		gl_entries = []
-
+		
 		self.make_customer_gl_entry(gl_entries)
 
 		self.make_tax_gl_entries(gl_entries)
@@ -487,7 +494,7 @@
 		return gl_entries
 
 	def make_customer_gl_entry(self, gl_entries):
-		if self.base_grand_total:
+		if self.grand_total:
 			gl_entries.append(
 				self.get_gl_dict({
 					"account": self.debit_to,
@@ -495,37 +502,42 @@
 					"party": self.customer,
 					"against": self.against_income_account,
 					"debit": self.base_grand_total,
-					"remarks": self.remarks,
+					"debit_in_account_currency": self.base_grand_total \
+						if self.party_account_currency==self.company_currency else self.grand_total,
 					"against_voucher": self.return_against if cint(self.is_return) else self.name,
 					"against_voucher_type": self.doctype
-				})
+				}, self.party_account_currency)
 			)
 
 	def make_tax_gl_entries(self, gl_entries):
 		for tax in self.get("taxes"):
 			if flt(tax.base_tax_amount_after_discount_amount):
+				account_currency = frappe.db.get_value("Account", tax.account_head, "currency")
 				gl_entries.append(
 					self.get_gl_dict({
 						"account": tax.account_head,
 						"against": self.customer,
 						"credit": flt(tax.base_tax_amount_after_discount_amount),
-						"remarks": self.remarks,
+						"credit_in_account_currency": flt(tax.base_tax_amount_after_discount_amount) \
+							if account_currency==self.company_currency else flt(tax.tax_amount_after_discount_amount),
 						"cost_center": tax.cost_center
-					})
+					}, account_currency)
 				)
 
 	def make_item_gl_entries(self, gl_entries):
 		# income account gl entries
 		for item in self.get("items"):
 			if flt(item.base_net_amount):
+				account_currency = frappe.db.get_value("Account", item.income_account, "currency")
 				gl_entries.append(
 					self.get_gl_dict({
 						"account": item.income_account,
 						"against": self.customer,
 						"credit": item.base_net_amount,
-						"remarks": self.remarks,
+						"credit_in_account_currency": item.base_net_amount \
+							if account_currency==self.company_currency else item.net_amount,
 						"cost_center": item.cost_center
-					})
+					}, account_currency)
 				)
 
 		# expense account gl entries
@@ -535,6 +547,7 @@
 
 	def make_pos_gl_entries(self, gl_entries):
 		if cint(self.is_pos) and self.cash_bank_account and self.paid_amount:
+			bank_account_currency = frappe.db.get_value("Account", self.cash_bank_account, "currency")
 			# POS, make payment entries
 			gl_entries.append(
 				self.get_gl_dict({
@@ -542,44 +555,50 @@
 					"party_type": "Customer",
 					"party": self.customer,
 					"against": self.cash_bank_account,
-					"credit": self.paid_amount,
-					"remarks": self.remarks,
+					"credit": self.base_paid_amount,
+					"credit_in_account_currency": self.base_paid_amount \
+						if self.party_account_currency==self.company_currency else self.paid_amount,
 					"against_voucher": self.return_against if cint(self.is_return) else self.name,
 					"against_voucher_type": self.doctype,
-				})
+				}, self.party_account_currency)
 			)
 			gl_entries.append(
 				self.get_gl_dict({
 					"account": self.cash_bank_account,
 					"against": self.customer,
-					"debit": self.paid_amount,
-					"remarks": self.remarks,
-				})
+					"debit": self.base_paid_amount,
+					"debit_in_account_currency": self.base_paid_amount \
+						if bank_account_currency==self.company_currency else self.paid_amount
+				}, bank_account_currency)
 			)
 
 	def make_write_off_gl_entry(self, gl_entries):
 		# write off entries, applicable if only pos
 		if self.write_off_account and self.write_off_amount:
+			write_off_account_currency = frappe.db.get_value("Account", self.write_off_account, "currency")
+			
 			gl_entries.append(
 				self.get_gl_dict({
 					"account": self.debit_to,
 					"party_type": "Customer",
 					"party": self.customer,
 					"against": self.write_off_account,
-					"credit": self.write_off_amount,
-					"remarks": self.remarks,
+					"credit": self.base_write_off_amount,
+					"credit_in_account_currency": self.base_write_off_amount \
+						if self.party_account_currency==self.company_currency else self.write_off_amount,
 					"against_voucher": self.return_against if cint(self.is_return) else self.name,
-					"against_voucher_type": self.doctype,
-				})
+					"against_voucher_type": self.doctype
+				}, self.party_account_currency)
 			)
 			gl_entries.append(
 				self.get_gl_dict({
 					"account": self.write_off_account,
 					"against": self.customer,
-					"debit": self.write_off_amount,
-					"remarks": self.remarks,
+					"debit": self.base_write_off_amount,
+					"debit_in_account_currency": self.base_write_off_amount \
+						if write_off_account_currency==self.company_currency else self.write_off_amount,
 					"cost_center": self.write_off_cost_center
-				})
+				}, write_off_account_currency)
 			)
 
 def get_list_context(context=None):
diff --git a/erpnext/accounts/doctype/sales_invoice_advance/sales_invoice_advance.json b/erpnext/accounts/doctype/sales_invoice_advance/sales_invoice_advance.json
index 722ae12..714cd00 100644
--- a/erpnext/accounts/doctype/sales_invoice_advance/sales_invoice_advance.json
+++ b/erpnext/accounts/doctype/sales_invoice_advance/sales_invoice_advance.json
@@ -1,89 +1,163 @@
 {
- "creation": "2013-02-22 01:27:41",
- "docstatus": 0,
- "doctype": "DocType",
+ "allow_copy": 0, 
+ "allow_import": 0, 
+ "allow_rename": 0, 
+ "creation": "2013-02-22 01:27:41", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
  "fields": [
   {
-   "fieldname": "journal_entry",
-   "fieldtype": "Link",
-   "in_list_view": 1,
-   "label": "Journal Entry",
-   "no_copy": 1,
-   "oldfieldname": "journal_voucher",
-   "oldfieldtype": "Link",
-   "options": "Journal Entry",
-   "permlevel": 0,
-   "print_width": "250px",
-   "read_only": 1,
+   "allow_on_submit": 0, 
+   "fieldname": "journal_entry", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 1, 
+   "label": "Journal Entry", 
+   "no_copy": 1, 
+   "oldfieldname": "journal_voucher", 
+   "oldfieldtype": "Link", 
+   "options": "Journal Entry", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_width": "250px", 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0, 
    "width": "250px"
-  },
+  }, 
   {
-   "fieldname": "remarks",
-   "fieldtype": "Small Text",
-   "in_list_view": 1,
-   "label": "Remarks",
-   "no_copy": 1,
-   "oldfieldname": "remarks",
-   "oldfieldtype": "Small Text",
-   "permlevel": 0,
-   "print_width": "150px",
-   "read_only": 1,
+   "allow_on_submit": 0, 
+   "fieldname": "remarks", 
+   "fieldtype": "Small Text", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 1, 
+   "label": "Remarks", 
+   "no_copy": 1, 
+   "oldfieldname": "remarks", 
+   "oldfieldtype": "Small Text", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_width": "150px", 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0, 
    "width": "150px"
-  },
+  }, 
   {
-   "fieldname": "jv_detail_no",
-   "fieldtype": "Data",
-   "hidden": 1,
-   "in_list_view": 0,
-   "label": "Journal Entry Detail No",
-   "no_copy": 1,
-   "oldfieldname": "jv_detail_no",
-   "oldfieldtype": "Data",
-   "permlevel": 0,
-   "print_hide": 1,
-   "print_width": "120px",
-   "read_only": 1,
+   "allow_on_submit": 0, 
+   "fieldname": "jv_detail_no", 
+   "fieldtype": "Data", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Journal Entry Detail No", 
+   "no_copy": 1, 
+   "oldfieldname": "jv_detail_no", 
+   "oldfieldtype": "Data", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "print_width": "120px", 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0, 
    "width": "120px"
-  },
+  }, 
   {
-   "fieldname": "col_break1",
-   "fieldtype": "Column Break",
-   "permlevel": 0
-  },
+   "allow_on_submit": 0, 
+   "fieldname": "col_break1", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
   {
-   "fieldname": "advance_amount",
-   "fieldtype": "Currency",
-   "in_list_view": 1,
-   "label": "Advance amount",
-   "no_copy": 1,
-   "oldfieldname": "advance_amount",
-   "oldfieldtype": "Currency",
-   "options": "Company:company:default_currency",
-   "permlevel": 0,
-   "print_width": "120px",
-   "read_only": 1,
+   "allow_on_submit": 0, 
+   "fieldname": "advance_amount", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 1, 
+   "label": "Advance amount", 
+   "no_copy": 1, 
+   "oldfieldname": "advance_amount", 
+   "oldfieldtype": "Currency", 
+   "options": "party_account_currency", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_width": "120px", 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0, 
    "width": "120px"
-  },
+  }, 
   {
-   "fieldname": "allocated_amount",
-   "fieldtype": "Currency",
-   "in_list_view": 1,
-   "label": "Allocated amount",
-   "no_copy": 1,
-   "oldfieldname": "allocated_amount",
-   "oldfieldtype": "Currency",
-   "options": "Company:company:default_currency",
-   "permlevel": 0,
-   "print_width": "120px",
+   "allow_on_submit": 0, 
+   "fieldname": "allocated_amount", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 1, 
+   "label": "Allocated amount", 
+   "no_copy": 1, 
+   "oldfieldname": "allocated_amount", 
+   "oldfieldtype": "Currency", 
+   "options": "party_account_currency", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_width": "120px", 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0, 
    "width": "120px"
   }
- ],
- "idx": 1,
- "istable": 1,
- "modified": "2014-12-25 16:30:19.446500",
- "modified_by": "Administrator",
- "module": "Accounts",
- "name": "Sales Invoice Advance",
- "owner": "Administrator",
- "permissions": []
-}
+ ], 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "idx": 1, 
+ "in_create": 0, 
+ "in_dialog": 0, 
+ "is_submittable": 0, 
+ "issingle": 0, 
+ "istable": 1, 
+ "modified": "2015-08-21 16:22:28.866049", 
+ "modified_by": "Administrator", 
+ "module": "Accounts", 
+ "name": "Sales Invoice Advance", 
+ "owner": "Administrator", 
+ "permissions": [], 
+ "read_only": 0, 
+ "read_only_onload": 0
+}
\ No newline at end of file
diff --git a/erpnext/accounts/general_ledger.py b/erpnext/accounts/general_ledger.py
index 7edd69f..ed2a049 100644
--- a/erpnext/accounts/general_ledger.py
+++ b/erpnext/accounts/general_ledger.py
@@ -27,14 +27,25 @@
 		gl_map = merge_similar_entries(gl_map)
 
 	for entry in gl_map:
-		# toggle debit, credit if negative entry
+		# toggle debit, credit if negative entry		
 		if flt(entry.debit) < 0:
 			entry.credit = flt(entry.credit) - flt(entry.debit)
 			entry.debit = 0.0
+			
+		if flt(entry.debit_in_account_currency) < 0:
+			entry.credit_in_account_currency = \
+				flt(entry.credit_in_account_currency) - flt(entry.debit_in_account_currency)
+			entry.debit_in_account_currency = 0.0
+		
 		if flt(entry.credit) < 0:
 			entry.debit = flt(entry.debit) - flt(entry.credit)
 			entry.credit = 0.0
-
+			
+		if flt(entry.credit_in_account_currency) < 0:
+			entry.debit_in_account_currency = \
+				flt(entry.debit_in_account_currency) - flt(entry.credit_in_account_currency)
+			entry.credit_in_account_currency = 0.0
+			
 	return gl_map
 
 def merge_similar_entries(gl_map):
@@ -45,7 +56,11 @@
 		same_head = check_if_in_list(entry, merged_gl_map)
 		if same_head:
 			same_head.debit	= flt(same_head.debit) + flt(entry.debit)
+			same_head.debit_in_account_currency	= \
+				flt(same_head.debit_in_account_currency) + flt(entry.debit_in_account_currency)
 			same_head.credit = flt(same_head.credit) + flt(entry.credit)
+			same_head.credit_in_account_currency = \
+				flt(same_head.credit_in_account_currency) + flt(entry.credit_in_account_currency)
 		else:
 			merged_gl_map.append(entry)
 
diff --git a/erpnext/accounts/page/accounts_browser/accounts_browser.js b/erpnext/accounts/page/accounts_browser/accounts_browser.js
index 77a87ff..5627781 100644
--- a/erpnext/accounts/page/accounts_browser/accounts_browser.js
+++ b/erpnext/accounts/page/accounts_browser/accounts_browser.js
@@ -211,7 +211,8 @@
 						'Income Account', 'Tax', 'Chargeable', 'Temporary'].join('\n'),
 					description: __("Optional. This setting will be used to filter in various transactions.") },
 				{fieldtype:'Float', fieldname:'tax_rate', label:__('Tax Rate')},
-				{fieldtype:'Link', fieldname:'warehouse', label:__('Warehouse'), options:"Warehouse"}
+				{fieldtype:'Link', fieldname:'warehouse', label:__('Warehouse'), options:"Warehouse"},
+				{fieldtype:'Link', fieldname:'currency', label:__('Currency'), options:"Currency"}
 			]
 		})
 
diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py
index 250286c..2b2912d 100644
--- a/erpnext/accounts/party.py
+++ b/erpnext/accounts/party.py
@@ -7,7 +7,7 @@
 import datetime
 from frappe import _, msgprint, scrub
 from frappe.defaults import get_user_permissions
-from frappe.utils import add_days, getdate, formatdate, flt, get_first_day, date_diff, nowdate
+from frappe.utils import add_days, getdate, formatdate, get_first_day, date_diff
 from erpnext.utilities.doctype.address.address import get_address_display
 from erpnext.utilities.doctype.contact.contact import get_contact_details
 
@@ -141,7 +141,19 @@
 		"due_date": get_due_date(posting_date, party_type, party, company)
 	}
 	return out
-
+	
+def validate_party_account(party):
+	party_account_defined_for_companies = [d.company for d in party.get("accounts")]
+	party_account_required_for_companies = []
+	for company, company_currency in frappe.db.sql("select name, default_currency from `tabCompany`"):
+		if party.default_currency and party.default_currency != company_currency \
+			and company not in party_account_defined_for_companies:
+				party_account_required_for_companies.append(company)
+				
+	if party_account_required_for_companies:
+		frappe.msgprint(_("Please mention Party Account for the following companies, as party currency is different from company's default currency: {0}")
+			.format("\n" + "\n".join(party_account_required_for_companies)))
+				
 @frappe.whitelist()
 def get_party_account(company, party, party_type):
 	"""Returns the account for the given `party`.
diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.js b/erpnext/buying/doctype/purchase_common/purchase_common.js
index 7693e08..f372cd8 100644
--- a/erpnext/buying/doctype/purchase_common/purchase_common.js
+++ b/erpnext/buying/doctype/purchase_common/purchase_common.js
@@ -157,20 +157,9 @@
 	},
 	add_deduct_tax: function(doc, cdt, cdn) {
 		this.calculate_taxes_and_totals();
-	},
-
-	calculate_outstanding_amount: function() {
-		if(this.frm.doc.doctype == "Purchase Invoice" && this.frm.doc.docstatus < 2) {
-			frappe.model.round_floats_in(this.frm.doc, ["base_grand_total", "total_advance", "write_off_amount"]);
-			this.frm.doc.total_amount_to_pay = flt(this.frm.doc.base_grand_total - this.frm.doc.write_off_amount,
-				precision("total_amount_to_pay"));
-			if (!this.frm.doc.is_return) {
-				this.frm.doc.outstanding_amount = flt(this.frm.doc.total_amount_to_pay - this.frm.doc.total_advance,
-					precision("outstanding_amount"));
-			}
-		}
 	}
 });
+
 cur_frm.add_fetch('project_name', 'cost_center', 'cost_center');
 
 erpnext.buying.get_default_bom = function(frm) {
diff --git a/erpnext/buying/doctype/supplier/supplier.py b/erpnext/buying/doctype/supplier/supplier.py
index af7716b..a70a771 100644
--- a/erpnext/buying/doctype/supplier/supplier.py
+++ b/erpnext/buying/doctype/supplier/supplier.py
@@ -8,6 +8,7 @@
 from frappe.model.naming import make_autoname
 from erpnext.utilities.address_and_contact import load_address_and_contact
 from erpnext.utilities.transaction_base import TransactionBase
+from erpnext.accounts.party import validate_party_account
 
 class Supplier(TransactionBase):
 	def get_feed(self):
@@ -44,6 +45,8 @@
 		if frappe.defaults.get_global_default('supp_master_name') == 'Naming Series':
 			if not self.naming_series:
 				msgprint(_("Series is mandatory"), raise_exception=1)
+				
+		validate_party_account(self)
 
 	def get_contacts(self,nm):
 		if nm:
diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py
index c7600df..6ba954f 100644
--- a/erpnext/controllers/accounts_controller.py
+++ b/erpnext/controllers/accounts_controller.py
@@ -16,6 +16,16 @@
 class CustomerFrozen(frappe.ValidationError): pass
 
 class AccountsController(TransactionBase):
+	def __init__(self, arg1, arg2=None):
+		super(AccountsController, self).__init__(arg1, arg2)
+		
+	@property
+	def company_currency(self):
+		if not hasattr(self, "__company_currency"):
+			self.__company_currency = get_company_currency(self.company)
+			
+		return self.__company_currency
+		
 	def validate(self):
 		if self.get("_action") and self._action != "update_after_submit":
 			self.set_missing_values(for_validate=True)
@@ -39,6 +49,7 @@
 			self.validate_enabled_taxes_and_charges()
 
 		self.validate_party()
+		self.validate_currency()
 
 	def on_submit(self):
 		if self.meta.get_field("is_recurring"):
@@ -187,7 +198,7 @@
 		if frappe.db.get_value(taxes_and_charges_doctype, self.taxes_and_charges, "disabled"):
 			frappe.throw(_("{0} '{1}' is disabled").format(taxes_and_charges_doctype, self.taxes_and_charges))
 
-	def get_gl_dict(self, args):
+	def get_gl_dict(self, args, account_currency=None):
 		"""this method populates the common properties of a gl entry record"""
 		gl_dict = frappe._dict({
 			'company': self.company,
@@ -198,11 +209,45 @@
 			'fiscal_year': self.fiscal_year,
 			'debit': 0,
 			'credit': 0,
+			'debit_in_account_currency': 0,
+			'credit_in_account_currency': 0,
 			'is_opening': self.get("is_opening") or "No",
 			'party_type': None,
 			'party': None
 		})
 		gl_dict.update(args)
+		
+		if not account_currency:
+			account_currency = frappe.db.get_value("Account", gl_dict.account, "currency")
+			
+		self.validate_account_currency(gl_dict.account, account_currency)
+		gl_dict = self.set_balance_in_account_currency(gl_dict, account_currency)
+						
+		return gl_dict
+		
+	def validate_account_currency(self, account, account_currency=None):
+		valid_currency = list(set([self.currency, self.company_currency]))
+		if account_currency not in valid_currency:
+			frappe.throw(_("Account {0} is invalid. Account Currency must be {1}")
+				.format(account, " or ".join(valid_currency)))
+		
+	def set_balance_in_account_currency(self, gl_dict, account_currency=None):			
+		if not self.get("conversion_rate") and account_currency!=self.company_currency:
+			frappe.throw(_("Account: {0} with currency: {1} can not be selected")
+				.format(gl_dict.account, account_currency))
+			
+		gl_dict["currency"] = self.company_currency if account_currency==self.company_currency \
+			else account_currency
+		
+		# set debit/credit in account currency if not provided
+		if flt(gl_dict.debit) and not flt(gl_dict.debit_in_account_currency):
+			gl_dict.debit_in_account_currency = gl_dict.debit if account_currency==self.company_currency \
+				else flt(gl_dict.debit / (self.get("conversion_rate")), 2)
+							
+		if flt(gl_dict.credit) and not flt(gl_dict.credit_in_account_currency):
+			gl_dict.credit_in_account_currency = gl_dict.credit if account_currency==self.company_currency \
+				else flt(gl_dict.credit / (self.get("conversion_rate")), 2)
+				
 		return gl_dict
 
 	def clear_unallocated_advances(self, childtype, parentfield):
@@ -357,18 +402,43 @@
 		if frozen_accounts_modifier in frappe.get_roles():
 			return
 
+		party_type, party = self.get_party()
+
+		if party_type:
+			if frappe.db.get_value(party_type, party, "is_frozen"): 
+				frappe.throw("{0} {1} is frozen".format(party_type, party), CustomerFrozen)
+				
+	def get_party(self):
 		party_type = None
 		if self.meta.get_field("customer"):
 			party_type = 'Customer'
 
 		elif self.meta.get_field("supplier"):
 			party_type = 'Supplier'
-
-		if party_type:
-			party = self.get(party_type.lower())
-			if frappe.db.get_value(party_type, party, "is_frozen"):
-				frappe.throw("{0} {1} is frozen".format(party_type, party), CustomerFrozen)
-
+			
+		party = self.get(party_type.lower()) if party_type else None
+		
+		return party_type, party
+								
+	def validate_currency(self):
+		if self.get("currency") and self.currency != self.company_currency:
+			party_type, party = self.get_party()
+			
+			existing_gle = frappe.db.get_value("GL Entry", {"party_type": party_type, 
+				"party": party, "company": self.company}, ["name", "currency"], as_dict=1)
+			currency_in_existing_entries = existing_gle.currency or self.company_currency
+			
+			if existing_gle:
+				if currency_in_existing_entries != self.company_currency \
+					and currency_in_existing_entries != self.currency:
+						frappe.throw(_("Currency must be {0} for {1} {2}")
+							.format(currency_in_existing_entries, party_type, party))
+			else:
+				party_currency = frappe.db.get_value(party_type, party, "default_currency")
+				if party_currency != self.company_currency and self.currency != party_currency:
+					frappe.throw(_("Currency must be same as {0} currency {1}")
+						.format(party_type, party_currency))
+				
 @frappe.whitelist()
 def get_tax_rate(account_head):
 	return frappe.db.get_value("Account", account_head, "tax_rate")
diff --git a/erpnext/controllers/stock_controller.py b/erpnext/controllers/stock_controller.py
index 19b5a9b..ccbad0d 100644
--- a/erpnext/controllers/stock_controller.py
+++ b/erpnext/controllers/stock_controller.py
@@ -46,22 +46,22 @@
 						# from warehouse account
 
 						self.check_expense_account(detail)
-
+						
 						gl_list.append(self.get_gl_dict({
-							"account": warehouse_account[sle.warehouse],
+							"account": warehouse_account[sle.warehouse]["name"],
 							"against": detail.expense_account,
 							"cost_center": detail.cost_center,
 							"remarks": self.get("remarks") or "Accounting Entry for Stock",
-							"debit": flt(sle.stock_value_difference, 2)
-						}))
+							"debit": flt(sle.stock_value_difference, 2),
+						}, warehouse_account[sle.warehouse]["currency"]))
 
-						# to target warehouse / expense account
+						# to target warehouse / expense account						
 						gl_list.append(self.get_gl_dict({
 							"account": detail.expense_account,
-							"against": warehouse_account[sle.warehouse],
+							"against": warehouse_account[sle.warehouse]["name"],
 							"cost_center": detail.cost_center,
 							"remarks": self.get("remarks") or "Accounting Entry for Stock",
-							"credit": flt(sle.stock_value_difference, 2)
+							"credit": flt(sle.stock_value_difference, 2),
 						}))
 					elif sle.warehouse not in warehouse_with_no_account:
 						warehouse_with_no_account.append(sle.warehouse)
@@ -69,7 +69,7 @@
 		if warehouse_with_no_account:
 			msgprint(_("No accounting entries for the following warehouses") + ": \n" +
 				"\n".join(warehouse_with_no_account))
-
+		
 		return process_gl_map(gl_list)
 
 	def get_voucher_details(self, default_expense_account, default_cost_center, sle_map):
@@ -336,6 +336,9 @@
 	return gl_entries
 
 def get_warehouse_account():
-	warehouse_account = dict(frappe.db.sql("""select warehouse, name from tabAccount
-		where account_type = 'Warehouse' and ifnull(warehouse, '') != ''"""))
+	warehouse_account = frappe._dict()
+	
+	for d in frappe.db.sql("""select warehouse, name, currency from tabAccount
+		where account_type = 'Warehouse' and ifnull(warehouse, '') != ''""", as_dict=1):
+			warehouse_account.setdefault(d.warehouse, d)
 	return warehouse_account
diff --git a/erpnext/controllers/taxes_and_totals.py b/erpnext/controllers/taxes_and_totals.py
index d526f66..0fbe22d 100644
--- a/erpnext/controllers/taxes_and_totals.py
+++ b/erpnext/controllers/taxes_and_totals.py
@@ -394,17 +394,21 @@
 		# NOTE:
 		# write_off_amount is only for POS Invoice
 		# total_advance is only for non POS Invoice
-
+		if self.doc.is_return:
+			return
+		
+		self.doc.round_floats_in(self.doc, ["grand_total", "total_advance", "write_off_amount"])
+		total_amount_to_pay = flt(self.doc.grand_total  - self.doc.total_advance - self.doc.write_off_amount,
+			self.doc.precision("grand_total"))
+			
 		if self.doc.doctype == "Sales Invoice":
-			if not self.doc.is_return:
-				self.doc.round_floats_in(self.doc, ["base_grand_total", "total_advance", "write_off_amount", "paid_amount"])
-				total_amount_to_pay = self.doc.base_grand_total - self.doc.write_off_amount
-				self.doc.outstanding_amount = flt(total_amount_to_pay - self.doc.total_advance - self.doc.paid_amount,
-					self.doc.precision("outstanding_amount"))
+			self.doc.round_floats_in(self.doc, ["paid_amount"])
+			outstanding_amount = flt(total_amount_to_pay - self.doc.paid_amount, self.doc.precision("outstanding_amount"))
+		elif self.doc.doctype == "Purchase Invoice":
+			outstanding_amount = flt(total_amount_to_pay, self.doc.precision("outstanding_amount"))
+		
+		if self.doc.party_account_currency == self.doc.currency:
+			self.doc.outstanding_amount = outstanding_amount
 		else:
-			self.doc.round_floats_in(self.doc, ["total_advance", "write_off_amount"])
-			self.doc.total_amount_to_pay = flt(self.doc.base_grand_total - self.doc.write_off_amount,
-				self.doc.precision("total_amount_to_pay"))
-			if not self.doc.is_return:
-				self.doc.outstanding_amount = flt(self.doc.total_amount_to_pay - self.doc.total_advance,
-					self.doc.precision("outstanding_amount"))
+			self.doc.outstanding_amount = flt(outstanding_amount * self.doc.conversion_rate, 
+				self.doc.precision("outstanding_amount"))
\ No newline at end of file
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 2a16ef3..71da98a 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -201,3 +201,4 @@
 
 # V6.0
 erpnext.patches.v6_0.set_default_title
+erpnext.patches.v6_0.multi_currency
diff --git a/erpnext/patches/v6_0/multi_currency.py b/erpnext/patches/v6_0/multi_currency.py
new file mode 100644
index 0000000..21c851b
--- /dev/null
+++ b/erpnext/patches/v6_0/multi_currency.py
@@ -0,0 +1,85 @@
+# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
+# License: GNU General Public License v3. See license.txt
+
+from __future__ import unicode_literals
+import frappe
+
+def execute():
+	# Reload doctype
+	for dt in ("Account", "GL Entry", "Journal Entry", 
+		"Journal Entry Account", "Sales Invoice", "Purchase Invoice"):
+			frappe.reload_doctype(dt)
+			
+	for company in frappe.get_all("Company", fields=["name", "default_currency", "default_receivable_account"]):
+		
+		# update currency in account and gl entry as per company currency
+		frappe.db.sql("""update `tabAccount` set currency = %s 
+			where ifnull(currency, '') = '' and company=%s""", (company.default_currency, company.name))
+		
+		# update newly introduced field's value in sales / purchase invoice
+		frappe.db.sql("""
+			update 
+				`tabSales Invoice`
+			set 
+				base_paid_amount=paid_amount,
+				base_write_off_amount=write_off_amount,
+				party_account_currency=%s
+			where company=%s
+		""", (company.default_currency, company.name))
+		
+		frappe.db.sql("""
+			update 
+				`tabPurchase Invoice`
+			set 
+				base_write_off_amount=write_off_amount,
+				party_account_currency=%s
+			where company=%s
+		""", (company.default_currency, company.name))
+		
+		# update exchange rate, debit/credit in account currency in Journal Entry
+		frappe.db.sql("""update `tabJournal Entry` set exchange_rate=1""")
+	
+		frappe.db.sql("""
+			update
+				`tabJournal Entry Account` jea, `tabJournal Entry` je
+			set 
+				debit_in_account_currency=debit,
+				credit_in_account_currency=credit,
+				currency=%s
+			where
+				jea.parent = je.name
+				and je.company=%s
+		""", (company.default_currency, company.name))
+	
+		# update debit/credit in account currency in GL Entry
+		frappe.db.sql("""
+			update
+				`tabGL Entry`
+			set 
+				debit_in_account_currency=debit,
+				credit_in_account_currency=credit,
+				currency=%s
+			where
+				company=%s
+		""", (company.default_currency, company.name))
+		
+		# Set party account if default currency of party other than company's default currency
+		for dt in ("Customer", "Supplier"):
+			parties = frappe.db.sql("""select name from `tab{0}` p
+				where ifnull(default_currency, '') != '' and default_currency != %s 
+				and not exists(select name from `tabParty Account` where parent=p.name and company=%s)"""
+				.format(dt), (company.default_currency, company.name))
+			
+			for p in parties:
+				party = frappe.get_doc(dt, p[0])
+				party_gle = frappe.db.get_value("GL Entry", {"party_type": dt, "party": p[0], 
+					"company": company.name}, ["account"], as_dict=True)
+					
+				party_account = party_gle.account or company.default_receivable_account
+				
+				party.append("party_accounts", {
+					"company": company.name,
+					"account": party_account
+				})
+				party.ignore_mandatory()
+				party.save()
\ No newline at end of file
diff --git a/erpnext/public/js/controllers/taxes_and_totals.js b/erpnext/public/js/controllers/taxes_and_totals.js
index 0b3ca7f..ad794d6 100644
--- a/erpnext/public/js/controllers/taxes_and_totals.js
+++ b/erpnext/public/js/controllers/taxes_and_totals.js
@@ -491,5 +491,45 @@
 		this.frm.doc.total_advance = flt(total_allocated_amount, precision("total_advance"));
 
 		this.calculate_outstanding_amount(update_paid_amount);
+	},
+	
+	calculate_outstanding_amount: function(update_paid_amount) {
+		// NOTE:
+		// paid_amount and write_off_amount is only for POS Invoice
+		// total_advance is only for non POS Invoice
+		if(this.frm.doc.is_return || this.frm.doc.docstatus > 0) return;
+		
+		frappe.model.round_floats_in(this.frm.doc, ["grand_total", "total_advance", "write_off_amount"]);
+		
+		var total_amount_to_pay = flt((this.frm.doc.grand_total - this.frm.doc.total_advance 
+			- this.frm.doc.write_off_amount), precision("grand_total"));
+		
+		if(this.frm.doc.doctype == "Sales Invoice") {
+			frappe.model.round_floats_in(this.frm.doc, ["paid_amount"]);
+			
+			if(this.frm.doc.is_pos) {
+				if(!this.frm.doc.paid_amount || update_paid_amount===undefined || update_paid_amount) {
+					this.frm.doc.paid_amount = flt(total_amount_to_pay);
+				}
+			} else {
+				this.frm.doc.paid_amount = 0
+			}
+			this.set_in_company_currency(this.frm.doc, ["paid_amount"]);
+			this.frm.refresh_field("paid_amount");
+			this.frm.refresh_field("base_paid_amount");
+			
+			var outstanding_amount =  flt(total_amount_to_pay - this.frm.doc.paid_amount, 
+				precision("outstanding_amount"));
+				
+		} else if(this.frm.doc.doctype == "Purchase Invoice") {
+			var outstanding_amount = flt(total_amount_to_pay, precision("outstanding_amount"));
+		}
+		
+		if(this.frm.doc.party_account_currency == this.frm.doc.currency) {			
+			this.frm.set_value("outstanding_amount", outstanding_amount);
+		} else {
+			this.frm.set_value("outstanding_amount", 
+				flt(outstanding_amount * this.frm.doc.conversion_rate, precision("outstanding_amount")));
+		}
 	}
 })
diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js
index c6b26bc..7f2cee7 100644
--- a/erpnext/public/js/controllers/transaction.js
+++ b/erpnext/public/js/controllers/transaction.js
@@ -423,11 +423,14 @@
 		setup_field_label_map(["base_total", "base_net_total", "base_total_taxes_and_charges",
 			"base_discount_amount", "base_grand_total", "base_rounded_total", "base_in_words",
 			"base_taxes_and_charges_added", "base_taxes_and_charges_deducted", "total_amount_to_pay",
-			"outstanding_amount", "total_advance", "paid_amount", "write_off_amount"], company_currency);
+			"base_paid_amount", "base_write_off_amount"
+		], company_currency);
 
 		setup_field_label_map(["total", "net_total", "total_taxes_and_charges", "discount_amount",
 			"grand_total", "taxes_and_charges_added", "taxes_and_charges_deducted",
-			"rounded_total", "in_words"], this.frm.doc.currency);
+			"rounded_total", "in_words", "paid_amount", "write_off_amount"], this.frm.doc.currency);
+			
+		setup_field_label_map(["outstanding_amount", "total_advance"], this.frm.doc.party_account_currency);
 
 		cur_frm.set_df_property("conversion_rate", "description", "1 " + this.frm.doc.currency
 			+ " = [?] " + company_currency)
@@ -440,7 +443,8 @@
 		// toggle fields
 		this.frm.toggle_display(["conversion_rate", "base_total", "base_net_total", "base_total_taxes_and_charges",
 			"base_taxes_and_charges_added", "base_taxes_and_charges_deducted",
-			"base_grand_total", "base_rounded_total", "base_in_words", "base_discount_amount"],
+			"base_grand_total", "base_rounded_total", "base_in_words", "base_discount_amount",
+			"base_paid_amount", "base_write_off_amount"],
 			this.frm.doc.currency != company_currency);
 
 		this.frm.toggle_display(["plc_conversion_rate", "price_list_currency"],
diff --git a/erpnext/public/js/pos/pos.js b/erpnext/public/js/pos/pos.js
index 5f82796..02eeab0 100644
--- a/erpnext/public/js/pos/pos.js
+++ b/erpnext/public/js/pos/pos.js
@@ -473,13 +473,11 @@
 			}
 			me.frm.set_value("mode_of_payment", values.mode_of_payment);
 
-			//me.frm.cscript.calculate_taxes_and_totals();
-
-			var paid_amount = flt((flt(values.paid_amount) - flt(values.change)) / me.frm.doc.conversion_rate, precision("paid_amount"));
+			var paid_amount = flt((flt(values.paid_amount) - flt(values.change)), precision("paid_amount"));
 			me.frm.set_value("paid_amount", paid_amount);
-
+			
 			// specifying writeoff amount here itself, so as to avoid recursion issue
-			me.frm.set_value("write_off_amount", me.frm.doc.base_grand_total - paid_amount);
+			me.frm.set_value("write_off_amount", me.frm.doc.grand_total - paid_amount);
 			me.frm.set_value("outstanding_amount", 0);
 
 			me.frm.savesubmit(this);
diff --git a/erpnext/selling/doctype/customer/customer.js b/erpnext/selling/doctype/customer/customer.js
index ac0f636..ab23d73 100644
--- a/erpnext/selling/doctype/customer/customer.js
+++ b/erpnext/selling/doctype/customer/customer.js
@@ -12,7 +12,15 @@
 
 	frm.toggle_display(['address_html','contact_html'], !frm.doc.__islocal);
 
-	if(!frm.doc.__islocal) erpnext.utils.render_address_and_contact(frm);
+	if(!frm.doc.__islocal) {
+		erpnext.utils.render_address_and_contact(frm);
+	}
+
+	var grid = cur_frm.get_field("sales_team").grid;
+	grid.set_column_disp("allocated_percentage", false);
+	grid.set_column_disp("allocated_amount", false);
+	grid.set_column_disp("incentives", false);
+
 })
 
 cur_frm.cscript.onload = function(doc, dt, dn) {
diff --git a/erpnext/selling/doctype/customer/customer.py b/erpnext/selling/doctype/customer/customer.py
index fe68966..ae5cb49 100644
--- a/erpnext/selling/doctype/customer/customer.py
+++ b/erpnext/selling/doctype/customer/customer.py
@@ -10,6 +10,7 @@
 
 from erpnext.utilities.transaction_base import TransactionBase
 from erpnext.utilities.address_and_contact import load_address_and_contact
+from erpnext.accounts.party import validate_party_account
 
 class Customer(TransactionBase):
 	def get_feed(self):
@@ -26,12 +27,13 @@
 		else:
 			self.name = make_autoname(self.naming_series+'.#####')
 
-	def validate_values(self):
+	def validate_mandatory(self):
 		if frappe.defaults.get_global_default('cust_master_name') == 'Naming Series' and not self.naming_series:
 			frappe.throw(_("Series is mandatory"), frappe.MandatoryError)
-
+			
 	def validate(self):
-		self.validate_values()
+		self.validate_mandatory()
+		validate_party_account(self)
 
 	def update_lead_status(self):
 		if self.lead_name:
diff --git a/erpnext/selling/doctype/sales_team/sales_team.json b/erpnext/selling/doctype/sales_team/sales_team.json
index dda6046..709e690 100644
--- a/erpnext/selling/doctype/sales_team/sales_team.json
+++ b/erpnext/selling/doctype/sales_team/sales_team.json
@@ -1,107 +1,182 @@
 {
- "creation": "2013-04-19 13:30:51.000000", 
+ "allow_copy": 0, 
+ "allow_import": 0, 
+ "allow_rename": 0, 
+ "creation": "2013-04-19 13:30:51", 
+ "custom": 0, 
  "docstatus": 0, 
  "doctype": "DocType", 
  "fields": [
   {
+   "allow_on_submit": 0, 
    "fieldname": "sales_person", 
    "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Sales Person", 
+   "no_copy": 0, 
    "oldfieldname": "sales_person", 
    "oldfieldtype": "Link", 
    "options": "Sales Person", 
    "permlevel": 0, 
+   "print_hide": 0, 
    "print_width": "200px", 
+   "read_only": 0, 
+   "report_hide": 0, 
    "reqd": 1, 
    "search_index": 1, 
+   "set_only_once": 0, 
+   "unique": 0, 
    "width": "200px"
   }, 
   {
-   "fieldname": "sales_designation", 
-   "fieldtype": "Data", 
-   "hidden": 0, 
-   "in_list_view": 1, 
-   "label": "Designation", 
-   "oldfieldname": "sales_designation", 
-   "oldfieldtype": "Data", 
-   "permlevel": 0, 
-   "print_width": "100px", 
-   "width": "100px"
-  }, 
-  {
+   "allow_on_submit": 0, 
    "fieldname": "contact_no", 
    "fieldtype": "Data", 
    "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Contact No.", 
+   "no_copy": 0, 
    "oldfieldname": "contact_no", 
    "oldfieldtype": "Data", 
    "permlevel": 0, 
+   "print_hide": 0, 
    "print_width": "100px", 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0, 
    "width": "100px"
   }, 
   {
+   "allow_on_submit": 0, 
    "fieldname": "col_break1", 
    "fieldtype": "Column Break", 
-   "permlevel": 0
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
   }, 
   {
+   "allow_on_submit": 0, 
    "fieldname": "allocated_percentage", 
    "fieldtype": "Float", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Contribution (%)", 
+   "no_copy": 0, 
    "oldfieldname": "allocated_percentage", 
    "oldfieldtype": "Currency", 
    "permlevel": 0, 
+   "print_hide": 0, 
    "print_width": "100px", 
+   "read_only": 0, 
+   "report_hide": 0, 
    "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0, 
    "width": "100px"
   }, 
   {
+   "allow_on_submit": 0, 
    "fieldname": "allocated_amount", 
    "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Contribution to Net Total", 
+   "no_copy": 0, 
    "oldfieldname": "allocated_amount", 
    "oldfieldtype": "Currency", 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
+   "print_hide": 0, 
    "print_width": "120px", 
    "read_only": 1, 
+   "report_hide": 0, 
    "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0, 
    "width": "120px"
   }, 
   {
+   "allow_on_submit": 0, 
    "fieldname": "incentives", 
    "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Incentives", 
+   "no_copy": 0, 
    "oldfieldname": "incentives", 
    "oldfieldtype": "Currency", 
    "options": "Company:company:default_currency", 
-   "permlevel": 0
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
   }, 
   {
+   "allow_on_submit": 0, 
    "fieldname": "parenttype", 
    "fieldtype": "Data", 
    "hidden": 1, 
+   "ignore_user_permissions": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Parenttype", 
+   "no_copy": 0, 
    "oldfieldname": "parenttype", 
    "oldfieldtype": "Data", 
    "permlevel": 0, 
    "print_hide": 1, 
-   "search_index": 1
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 1, 
+   "set_only_once": 0, 
+   "unique": 0
   }
  ], 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
  "idx": 1, 
+ "in_create": 0, 
+ "in_dialog": 0, 
+ "is_submittable": 0, 
+ "issingle": 0, 
  "istable": 1, 
- "modified": "2013-12-31 19:00:14.000000", 
+ "modified": "2015-08-13 16:30:24.146848", 
  "modified_by": "Administrator", 
  "module": "Selling", 
  "name": "Sales Team", 
- "owner": "Administrator"
+ "owner": "Administrator", 
+ "permissions": [], 
+ "read_only": 0, 
+ "read_only_onload": 0
 }
\ No newline at end of file
diff --git a/erpnext/selling/sales_common.js b/erpnext/selling/sales_common.js
index 5404947..6a8744a 100644
--- a/erpnext/selling/sales_common.js
+++ b/erpnext/selling/sales_common.js
@@ -206,30 +206,6 @@
 		}
 	},
 
-	calculate_outstanding_amount: function(update_paid_amount) {
-		// NOTE:
-		// paid_amount and write_off_amount is only for POS Invoice
-		// total_advance is only for non POS Invoice
-		if(this.frm.doc.doctype == "Sales Invoice" && this.frm.doc.docstatus==0 && !this.frm.doc.is_return) {
-			frappe.model.round_floats_in(this.frm.doc, ["base_grand_total", "total_advance", "write_off_amount",
-				"paid_amount"]);
-			var total_amount_to_pay = this.frm.doc.base_grand_total - this.frm.doc.write_off_amount
-				- this.frm.doc.total_advance;
-			if(this.frm.doc.is_pos) {
-				if(!this.frm.doc.paid_amount || update_paid_amount===undefined || update_paid_amount) {
-					this.frm.doc.paid_amount = flt(total_amount_to_pay);
-					this.frm.refresh_field("paid_amount");
-				}
-			} else {
-				this.frm.doc.paid_amount = 0
-				this.frm.refresh_field("paid_amount");
-			}
-
-			this.frm.set_value("outstanding_amount", flt(total_amount_to_pay
-				- this.frm.doc.paid_amount, precision("outstanding_amount")));
-		}
-	},
-
 	calculate_commission: function() {
 		if(this.frm.fields_dict.commission_rate) {
 			if(this.frm.doc.commission_rate > 100) {
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.js b/erpnext/stock/doctype/delivery_note/delivery_note.js
index e7ede65..17194fd 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.js
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.js
@@ -10,17 +10,6 @@
 		this._super();
 
 		if (!doc.is_return) {
-			if(doc.__onload && !doc.__onload.billing_complete && doc.docstatus==1) {
-				// show Make Invoice button only if Delivery Note is not created from Sales Invoice
-				var from_sales_invoice = false;
-				from_sales_invoice = cur_frm.doc.items.some(function(item) {
-					return item.against_sales_invoice ? true : false;
-				});
-
-				if(!from_sales_invoice)
-					cur_frm.add_custom_button(__('Invoice'), this.make_sales_invoice).addClass("btn-primary");
-			}
-
 			if(flt(doc.per_installed, 2) < 100 && doc.docstatus==1)
 				cur_frm.add_custom_button(__('Installation Note'), this.make_installation_note);
 
@@ -59,7 +48,16 @@
 			}
 		}
 
+		if(doc.__onload && !doc.__onload.billing_complete && doc.docstatus==1 && !doc.is_return) {
+			// show Make Invoice button only if Delivery Note is not created from Sales Invoice
+			var from_sales_invoice = false;
+			from_sales_invoice = cur_frm.doc.items.some(function(item) {
+				return item.against_sales_invoice ? true : false;
+			});
 
+			if(!from_sales_invoice)
+				cur_frm.add_custom_button(__('Invoice'), this.make_sales_invoice).addClass("btn-primary");
+		}
 
 		erpnext.stock.delivery_note.set_print_hide(doc, dt, dn);
 
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
index 1ab866c..f6649c1 100644
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
@@ -307,23 +307,28 @@
 					val_rate_db_precision = 6 if cint(d.precision("valuation_rate")) <= 6 else 9
 
 					# warehouse account
+					stock_value_diff = flt(flt(d.valuation_rate, val_rate_db_precision) * flt(d.qty) 
+						* flt(d.conversion_factor),	d.precision("base_net_amount"))
+						
 					gl_entries.append(self.get_gl_dict({
-						"account": warehouse_account[d.warehouse],
+						"account": warehouse_account[d.warehouse]["name"],
 						"against": stock_rbnb,
 						"cost_center": d.cost_center,
 						"remarks": self.get("remarks") or _("Accounting Entry for Stock"),
-						"debit": flt(flt(d.valuation_rate, val_rate_db_precision) * flt(d.qty) * flt(d.conversion_factor),
-							self.precision("base_net_amount", d))
-					}))
+						"debit": stock_value_diff
+					}, warehouse_account[d.warehouse]["currency"]))
 
 					# stock received but not billed
+					stock_rbnb_currency = frappe.db.get_value("Account", stock_rbnb, "currency")
 					gl_entries.append(self.get_gl_dict({
 						"account": stock_rbnb,
-						"against": warehouse_account[d.warehouse],
+						"against": warehouse_account[d.warehouse]["name"],
 						"cost_center": d.cost_center,
 						"remarks": self.get("remarks") or _("Accounting Entry for Stock"),
-						"credit": flt(d.base_net_amount, self.precision("base_net_amount", d))
-					}))
+						"credit": flt(d.base_net_amount, d.precision("base_net_amount")),
+						"credit_in_account_currency": flt(d.base_net_amount, d.precision("base_net_amount")) \
+							if stock_rbnb_currency==self.company_currency else flt(d.net_amount, d.precision("net_amount"))
+					}, stock_rbnb_currency))
 
 					negative_expense_to_be_booked += flt(d.item_tax_amount)
 
@@ -331,7 +336,7 @@
 					if flt(d.landed_cost_voucher_amount):
 						gl_entries.append(self.get_gl_dict({
 							"account": expenses_included_in_valuation,
-							"against": warehouse_account[d.warehouse],
+							"against": warehouse_account[d.warehouse]["name"],
 							"cost_center": d.cost_center,
 							"remarks": self.get("remarks") or _("Accounting Entry for Stock"),
 							"credit": flt(d.landed_cost_voucher_amount)
@@ -340,29 +345,29 @@
 					# sub-contracting warehouse
 					if flt(d.rm_supp_cost) and warehouse_account.get(self.supplier_warehouse):
 						gl_entries.append(self.get_gl_dict({
-							"account": warehouse_account[self.supplier_warehouse],
-							"against": warehouse_account[d.warehouse],
+							"account": warehouse_account[self.supplier_warehouse]["name"],
+							"against": warehouse_account[d.warehouse]["name"],
 							"cost_center": d.cost_center,
 							"remarks": self.get("remarks") or _("Accounting Entry for Stock"),
 							"credit": flt(d.rm_supp_cost)
-						}))
+						}, warehouse_account[self.supplier_warehouse]["currency"]))
 
 					# divisional loss adjustment
 					sle_valuation_amount = flt(flt(d.valuation_rate, val_rate_db_precision) * flt(d.qty) * flt(d.conversion_factor),
 							self.precision("base_net_amount", d))
 
 					distributed_amount = flt(flt(d.base_net_amount, self.precision("base_net_amount", d))) + \
-						flt(d.landed_cost_voucher_amount) + flt(d.rm_supp_cost) + flt(d.item_tax_amount)
+						flt(d.landed_cost_voucher_amount) + flt(d.rm_supp_cost)
 
 					divisional_loss = flt(distributed_amount - sle_valuation_amount, self.precision("base_net_amount", d))
 					if divisional_loss:
 						gl_entries.append(self.get_gl_dict({
 							"account": stock_rbnb,
-							"against": warehouse_account[d.warehouse],
+							"against": warehouse_account[d.warehouse]["name"],
 							"cost_center": d.cost_center,
 							"remarks": self.get("remarks") or _("Accounting Entry for Stock"),
 							"debit": divisional_loss
-						}))
+						}, stock_rbnb_currency))
 
 				elif d.warehouse not in warehouse_with_no_account or \
 					d.rejected_warehouse not in warehouse_with_no_account: