Discount amount in party currency
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
index b27a2ab..9f70c70 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
@@ -423,6 +423,15 @@
    "permlevel": 0
   }, 
   {
+   "fieldname": "other_charges_total_export", 
+   "fieldtype": "Currency", 
+   "label": "Total Taxes and Charges", 
+   "options": "currency", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 1
+  }, 
+  {
    "fieldname": "other_charges_total", 
    "fieldtype": "Currency", 
    "label": "Total Taxes and Charges (Company Currency)", 
@@ -439,23 +448,24 @@
    "permlevel": 0
   }, 
   {
-   "fieldname": "other_charges_total_export", 
-   "fieldtype": "Currency", 
-   "label": "Total Taxes and Charges", 
-   "options": "currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 1
-  }, 
-  {
    "fieldname": "discount_amount", 
    "fieldtype": "Currency", 
    "label": "Discount Amount", 
-   "options": "Company:company:default_currency", 
+   "options": "currency", 
    "permlevel": 0, 
    "print_hide": 0
   }, 
   {
+   "fieldname": "base_discount_amount", 
+   "fieldtype": "Currency", 
+   "label": "Discount Amount (Company Currency)", 
+   "options": "Company:company:default_currency", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "read_only": 1
+  }, 
+  {
    "fieldname": "totals", 
    "fieldtype": "Section Break", 
    "label": "Totals", 
@@ -1192,7 +1202,7 @@
  "icon": "icon-file-text", 
  "idx": 1, 
  "is_submittable": 1, 
- "modified": "2014-12-11 16:26:12.402110", 
+ "modified": "2015-01-12 17:34:36.353241", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Sales Invoice", 
diff --git a/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js b/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js
index d11bf29..f4e14b8 100644
--- a/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js
+++ b/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js
@@ -46,17 +46,17 @@
 		var new_val = flt(val)/flt(doc.conversion_rate);
 		return new_val;
 	}
-	
+
 	function print_hide(fieldname) {
 		var doc_field = frappe.meta.get_docfield(doc.doctype, fieldname, doc.name);
 		return doc_field.print_hide;
 	}
-	
+
 	out ='';
 	if (!doc.print_without_amount) {
 		var cl = doc.other_charges || [];
 
-		// outer table	
+		// outer table
 		var out='<div><table class="noborder" style="width:100%"><tr><td style="width: 60%"></td><td>';
 
 		// main table
@@ -77,12 +77,12 @@
 
 		// Discount Amount
 		if(!print_hide('discount_amount') && doc.discount_amount)
-			out += make_row('Discount Amount', convert_rate(doc.discount_amount), 0);
+			out += make_row('Discount Amount', doc.discount_amount, 0);
 
 		// grand total
 		if(!print_hide('grand_total_export'))
 			out += make_row('Grand Total', doc.grand_total_export, 1);
-		
+
 		if(!print_hide('rounded_total_export'))
 			out += make_row('Rounded Total', doc.rounded_total_export, 1);
 
@@ -92,7 +92,7 @@
 			out += '<table><tr><td style="width:25%;"><b>In Words</b></td>';
 			out += '<td style="width:50%;">' + doc.in_words_export + '</td></tr>';
 		}
-		out += '</table></td></tr></table></div>';	 
+		out += '</table></td></tr></table></div>';
 	}
 	return out;
 }
@@ -139,14 +139,14 @@
 			"account_type": ["Tax", "Chargeable", "Income Account"],
 			"company": doc.company
 		}
-	}	
+	}
 }
 
 cur_frm.fields_dict['other_charges'].grid.get_field("cost_center").get_query = function(doc) {
 	return{
 		'company': doc.company,
 		'group_or_ledger': "Ledger"
-	}	
+	}
 }
 
 cur_frm.cscript.rate = function(doc, cdt, cdn) {
diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py
index 02fdf2c..5219339 100644
--- a/erpnext/controllers/accounts_controller.py
+++ b/erpnext/controllers/accounts_controller.py
@@ -295,7 +295,7 @@
 			self.precision("tax_amount", tax))
 
 	def adjust_discount_amount_loss(self, tax):
-		discount_amount_loss = self.grand_total - flt(self.discount_amount) - tax.total
+		discount_amount_loss = self.grand_total - flt(self.base_discount_amount) - tax.total
 		tax.tax_amount_after_discount_amount = flt(tax.tax_amount_after_discount_amount +
 			discount_amount_loss, self.precision("tax_amount", tax))
 		tax.total = flt(tax.total + discount_amount_loss, self.precision("total", tax))
diff --git a/erpnext/controllers/selling_controller.py b/erpnext/controllers/selling_controller.py
index 68cdf18..4b0cd4e 100644
--- a/erpnext/controllers/selling_controller.py
+++ b/erpnext/controllers/selling_controller.py
@@ -218,8 +218,7 @@
 	def calculate_totals(self):
 		self.grand_total = flt(self.tax_doclist[-1].total if self.tax_doclist else self.net_total)
 
-		self.grand_total_export = flt(self.grand_total / self.conversion_rate) \
-			if self.tax_doclist else self.net_total_export
+		self.grand_total_export = flt(self.grand_total / self.conversion_rate)
 
 		self.other_charges_total = flt(self.grand_total - self.net_total, self.precision("other_charges_total"))
 
@@ -234,16 +233,20 @@
 
 	def apply_discount_amount(self):
 		if self.discount_amount:
+			self.base_discount_amount = flt(self.discount_amount * self.conversion_rate, self.precision("base_discount_amount"))
+
 			grand_total_for_discount_amount = self.get_grand_total_for_discount_amount()
 
 			if grand_total_for_discount_amount:
 				# calculate item amount after Discount Amount
 				for item in self.item_doclist:
-					distributed_amount = flt(self.discount_amount) * item.base_amount / grand_total_for_discount_amount
+					distributed_amount = flt(self.base_discount_amount) * item.base_amount / grand_total_for_discount_amount
 					item.base_amount = flt(item.base_amount - distributed_amount, self.precision("base_amount", item))
 
 				self.discount_amount_applied = True
 				self._calculate_taxes_and_totals()
+		else:
+			self.base_discount_amount = 0
 
 	def get_grand_total_for_discount_amount(self):
 		actual_taxes_dict = {}
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 33fa396..7fda960 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -90,3 +90,4 @@
 erpnext.patches.v4_2.update_requested_and_ordered_qty
 execute:frappe.delete_doc("DocType", "Contact Control")
 erpnext.patches.v4_2.recalculate_bom_costs
+erpnext.patches.v4_2.discount_amount
diff --git a/erpnext/patches/v4_2/discount_amount.py b/erpnext/patches/v4_2/discount_amount.py
new file mode 100644
index 0000000..e23a10e
--- /dev/null
+++ b/erpnext/patches/v4_2/discount_amount.py
@@ -0,0 +1,12 @@
+# 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
+from frappe.modules import scrub, get_doctype_module
+
+def execute():
+	for dt in ["Quotation", "Sales Order", "Delivery Note", "Sales invoice"]:
+		frappe.reload_doc(get_doctype_module(dt), "doctype", scrub(dt))
+		frappe.db.sql("""update `tab{0}` set base_discount_amount=discount_amount,
+			discount_amount=discount_amount/conversion_rate""".format(dt))
diff --git a/erpnext/public/js/transaction.js b/erpnext/public/js/transaction.js
index acb841b..6d38b46 100644
--- a/erpnext/public/js/transaction.js
+++ b/erpnext/public/js/transaction.js
@@ -734,7 +734,7 @@
 	},
 
 	adjust_discount_amount_loss: function(tax) {
-		var discount_amount_loss = this.frm.doc.grand_total - flt(this.frm.doc.discount_amount) - tax.total;
+		var discount_amount_loss = this.frm.doc.grand_total - flt(this.frm.doc.base_discount_amount) - tax.total;
 		tax.tax_amount_after_discount_amount = flt(tax.tax_amount_after_discount_amount +
 			discount_amount_loss, precision("tax_amount", tax));
 		tax.total = flt(tax.total + discount_amount_loss, precision("total", tax));
@@ -748,8 +748,7 @@
 			// distribute the tax amount proportionally to each item row
 			var actual = flt(tax.rate, precision("tax_amount", tax));
 			current_tax_amount = this.frm.doc.net_total ?
-				((item.base_amount / this.frm.doc.net_total) * actual) :
-				0.0;
+			((item.base_amount / this.frm.doc.net_total) * actual) : 0.0;
 
 		} else if(tax.charge_type == "On Net Total") {
 			current_tax_amount = (tax_rate / 100.0) * item.base_amount;
diff --git a/erpnext/selling/doctype/quotation/quotation.json b/erpnext/selling/doctype/quotation/quotation.json
index 5d960e9..9af5029 100644
--- a/erpnext/selling/doctype/quotation/quotation.json
+++ b/erpnext/selling/doctype/quotation/quotation.json
@@ -406,6 +406,15 @@
    "permlevel": 0
   }, 
   {
+   "fieldname": "other_charges_total_export", 
+   "fieldtype": "Currency", 
+   "label": "Taxes and Charges Total", 
+   "options": "currency", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 1
+  }, 
+  {
    "fieldname": "other_charges_total", 
    "fieldtype": "Currency", 
    "label": "Taxes and Charges Total (Company Currency)", 
@@ -422,22 +431,23 @@
    "permlevel": 0
   }, 
   {
-   "fieldname": "other_charges_total_export", 
-   "fieldtype": "Currency", 
-   "label": "Taxes and Charges Total", 
-   "options": "currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 1
-  }, 
-  {
    "fieldname": "discount_amount", 
    "fieldtype": "Currency", 
    "label": "Discount Amount", 
-   "options": "Company:company:default_currency", 
+   "options": "currency", 
    "permlevel": 0
   }, 
   {
+   "fieldname": "base_discount_amount", 
+   "fieldtype": "Currency", 
+   "label": "Discount Amount (Company Currency)", 
+   "options": "Company:company:default_currency", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "read_only": 1
+  }, 
+  {
    "fieldname": "totals", 
    "fieldtype": "Section Break", 
    "label": "Totals", 
@@ -832,7 +842,7 @@
  "idx": 1, 
  "is_submittable": 1, 
  "max_attachments": 1, 
- "modified": "2014-09-09 05:35:33.413559", 
+ "modified": "2015-01-12 16:57:14.706270", 
  "modified_by": "Administrator", 
  "module": "Selling", 
  "name": "Quotation", 
diff --git a/erpnext/selling/doctype/sales_order/sales_order.json b/erpnext/selling/doctype/sales_order/sales_order.json
index 5064703..4ffc603 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.json
+++ b/erpnext/selling/doctype/sales_order/sales_order.json
@@ -421,11 +421,6 @@
    "read_only": 1
   }, 
   {
-   "fieldname": "column_break_46", 
-   "fieldtype": "Column Break", 
-   "permlevel": 0
-  }, 
-  {
    "fieldname": "other_charges_total", 
    "fieldtype": "Currency", 
    "label": "Taxes and Charges Total (Company Currency)", 
@@ -438,11 +433,27 @@
    "width": "150px"
   }, 
   {
+   "fieldname": "column_break_46", 
+   "fieldtype": "Column Break", 
+   "permlevel": 0
+  }, 
+  {
    "fieldname": "discount_amount", 
    "fieldtype": "Currency", 
    "label": "Discount Amount", 
+   "options": "currency", 
+   "permlevel": 0, 
+   "print_hide": 0
+  }, 
+  {
+   "fieldname": "base_discount_amount", 
+   "fieldtype": "Currency", 
+   "label": "Discount Amount (Company Currency)", 
    "options": "Company:company:default_currency", 
-   "permlevel": 0
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "read_only": 1
   }, 
   {
    "fieldname": "totals", 
@@ -491,14 +502,6 @@
    "width": "200px"
   }, 
   {
-   "fieldname": "advance_paid", 
-   "fieldtype": "Currency", 
-   "label": "Advance Paid", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 1
-  }, 
-  {
    "fieldname": "column_break3", 
    "fieldtype": "Column Break", 
    "oldfieldtype": "Column Break", 
@@ -543,6 +546,15 @@
    "width": "200px"
   }, 
   {
+   "fieldname": "advance_paid", 
+   "fieldtype": "Currency", 
+   "label": "Advance Paid", 
+   "options": "Company:company:default_currency", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 1
+  }, 
+  {
    "fieldname": "view_details", 
    "fieldtype": "Fold", 
    "label": "View Details", 
@@ -1021,7 +1033,7 @@
  "idx": 1, 
  "is_submittable": 1, 
  "issingle": 0, 
- "modified": "2014-12-16 10:36:47.295144", 
+ "modified": "2015-01-12 15:16:51.611467", 
  "modified_by": "Administrator", 
  "module": "Selling", 
  "name": "Sales Order", 
diff --git a/erpnext/selling/sales_common.js b/erpnext/selling/sales_common.js
index c7c21fd..3a01811 100644
--- a/erpnext/selling/sales_common.js
+++ b/erpnext/selling/sales_common.js
@@ -342,8 +342,7 @@
 		var tax_count = this.frm.tax_doclist.length;
 
 		this.frm.doc.grand_total = flt(tax_count ? this.frm.tax_doclist[tax_count - 1].total : this.frm.doc.net_total);
-		this.frm.doc.grand_total_export = flt(tax_count ?
-			flt(this.frm.doc.grand_total / this.frm.doc.conversion_rate) : this.frm.doc.net_total_export);
+		this.frm.doc.grand_total_export = flt(this.frm.doc.grand_total / this.frm.doc.conversion_rate);
 
 		this.frm.doc.other_charges_total = flt(this.frm.doc.grand_total - this.frm.doc.net_total,
 			precision("other_charges_total"));
@@ -363,17 +362,22 @@
 		var distributed_amount = 0.0;
 
 		if (this.frm.doc.discount_amount) {
+			this.frm.set_value("base_discount_amount",
+				flt(this.frm.doc.discount_amount * this.frm.doc.conversion_rate, precision("base_discount_amount")))
+
 			var grand_total_for_discount_amount = this.get_grand_total_for_discount_amount();
 			// calculate item amount after Discount Amount
 			if (grand_total_for_discount_amount) {
 				$.each(this.frm.item_doclist, function(i, item) {
-					distributed_amount = flt(me.frm.doc.discount_amount) * item.base_amount / grand_total_for_discount_amount;
+					distributed_amount = flt(me.frm.doc.base_discount_amount) * item.base_amount / grand_total_for_discount_amount;
 					item.base_amount = flt(item.base_amount - distributed_amount, precision("base_amount", item));
 				});
 
 				this.discount_amount_applied = true;
 				this._calculate_taxes_and_totals();
 			}
+		} else {
+			this.frm.set_value("base_discount_amount", 0);
 		}
 	},
 
@@ -507,12 +511,12 @@
 				}
 			});
 		};
-		setup_field_label_map(["net_total", "other_charges_total", "grand_total",
+		setup_field_label_map(["net_total", "other_charges_total", "base_discount_amount", "grand_total",
 			"rounded_total", "in_words",
 			"outstanding_amount", "total_advance", "paid_amount", "write_off_amount"],
 			company_currency);
 
-		setup_field_label_map(["net_total_export", "other_charges_total_export", "grand_total_export",
+		setup_field_label_map(["net_total_export", "other_charges_total_export", "discount_amount", "grand_total_export",
 			"rounded_total_export", "in_words_export"], this.frm.doc.currency);
 
 		cur_frm.set_df_property("conversion_rate", "description", "1 " + this.frm.doc.currency
@@ -525,7 +529,7 @@
 
 		// toggle fields
 		this.frm.toggle_display(["conversion_rate", "net_total", "other_charges_total",
-			"grand_total", "rounded_total", "in_words"],
+			"grand_total", "rounded_total", "in_words", "base_discount_amount"],
 			this.frm.doc.currency != company_currency);
 
 		this.frm.toggle_display(["plc_conversion_rate", "price_list_currency"],
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.json b/erpnext/stock/doctype/delivery_note/delivery_note.json
index 98e7748..c7a25d2 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.json
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.json
@@ -435,6 +435,15 @@
    "permlevel": 0
   }, 
   {
+   "fieldname": "other_charges_total_export", 
+   "fieldtype": "Currency", 
+   "label": "Taxes and Charges Total", 
+   "options": "Company:company:default_currency", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 1
+  }, 
+  {
    "fieldname": "other_charges_total", 
    "fieldtype": "Currency", 
    "label": "Taxes and Charges Total (Company Currency)", 
@@ -453,22 +462,23 @@
    "permlevel": 0
   }, 
   {
-   "fieldname": "other_charges_total_export", 
-   "fieldtype": "Currency", 
-   "label": "Taxes and Charges Total", 
-   "options": "Company:company:default_currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 1
-  }, 
-  {
    "fieldname": "discount_amount", 
    "fieldtype": "Currency", 
    "label": "Discount Amount", 
-   "options": "Company:company:default_currency", 
+   "options": "currency", 
    "permlevel": 0
   }, 
   {
+   "fieldname": "base_discount_amount", 
+   "fieldtype": "Currency", 
+   "label": "Discount Amount (Company Currency)", 
+   "options": "Company:company:default_currency", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "read_only": 1
+  }, 
+  {
    "fieldname": "totals", 
    "fieldtype": "Section Break", 
    "label": "Totals", 
@@ -1013,7 +1023,7 @@
  "idx": 1, 
  "in_create": 0, 
  "is_submittable": 1, 
- "modified": "2014-12-22 14:58:19.575566", 
+ "modified": "2015-01-12 16:56:39.975961", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Delivery Note", 
diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py
index fffb52e..5145e0a 100644
--- a/erpnext/stock/get_item_details.py
+++ b/erpnext/stock/get_item_details.py
@@ -4,7 +4,7 @@
 from __future__ import unicode_literals
 import frappe
 from frappe import _, throw
-from frappe.utils import flt, cint, add_days
+from frappe.utils import flt, cint, add_days, cstr
 import json
 from erpnext.accounts.doctype.pricing_rule.pricing_rule import get_pricing_rule_for_item
 from erpnext.setup.utils import get_exchange_rate
@@ -140,7 +140,7 @@
 
 		"item_code": item.name,
 		"item_name": item.item_name,
-		"description": item.description_html or item.description,
+		"description": cstr(item.description_html).strip() or cstr(item.description).strip(),
 		"warehouse": user_default_warehouse or args.warehouse or item.default_warehouse,
 		"income_account": (item.income_account
 			or args.income_account