discount loss adjustment in base currency
diff --git a/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.json b/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.json
index 67f7ab4..701f1ac 100644
--- a/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.json
+++ b/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.json
@@ -49,16 +49,6 @@
"permlevel": 0
},
{
- "fieldname": "rate",
- "fieldtype": "Float",
- "in_list_view": 1,
- "label": "Rate",
- "oldfieldname": "rate",
- "oldfieldtype": "Currency",
- "permlevel": 0,
- "reqd": 0
- },
- {
"fieldname": "col_break_1",
"fieldtype": "Column Break",
"permlevel": 0,
@@ -90,6 +80,22 @@
"width": "150px"
},
{
+ "fieldname": "section_break_8",
+ "fieldtype": "Section Break",
+ "permlevel": 0,
+ "precision": ""
+ },
+ {
+ "fieldname": "rate",
+ "fieldtype": "Float",
+ "in_list_view": 1,
+ "label": "Rate",
+ "oldfieldname": "rate",
+ "oldfieldtype": "Currency",
+ "permlevel": 0,
+ "reqd": 0
+ },
+ {
"fieldname": "section_break_9",
"fieldtype": "Section Break",
"permlevel": 0,
@@ -186,7 +192,7 @@
"hide_heading": 1,
"idx": 1,
"istable": 1,
- "modified": "2015-02-25 02:50:44.152307",
+ "modified": "2015-03-04 15:16:30.732876",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Taxes and Charges",
diff --git a/erpnext/controllers/taxes_and_totals.py b/erpnext/controllers/taxes_and_totals.py
index 9637f39..a4be3f9 100644
--- a/erpnext/controllers/taxes_and_totals.py
+++ b/erpnext/controllers/taxes_and_totals.py
@@ -226,11 +226,13 @@
# set precision in the last item iteration
if n == len(self.doc.get("items")) - 1:
self.round_off_totals(tax)
-
+
# adjust Discount Amount loss in last tax iteration
if i == (len(self.doc.get("taxes")) - 1) and self.discount_amount_applied \
and self.doc.discount_amount:
self.adjust_discount_amount_loss(tax)
+
+
def get_current_tax_amount(self, item, tax, item_tax_map):
tax_rate = self._get_tax_rate(tax, item_tax_map)
@@ -275,8 +277,10 @@
def adjust_discount_amount_loss(self, tax):
discount_amount_loss = self.doc.grand_total - flt(self.doc.discount_amount) - tax.total
tax.tax_amount_after_discount_amount = flt(tax.tax_amount_after_discount_amount +
- discount_amount_loss, self.doc.precision("tax_amount", tax))
- tax.total = flt(tax.total + discount_amount_loss, self.doc.precision("total", tax))
+ discount_amount_loss, tax.precision("tax_amount"))
+ tax.total = flt(tax.total + discount_amount_loss, tax.precision("total"))
+
+ self._set_in_company_currency(tax, ["total", "tax_amount_after_discount_amount"])
def calculate_totals(self):
self.doc.grand_total = flt(self.doc.get("taxes")[-1].total