discount loss adjustment in base currency

This commit is contained in:
Nabin Hait
2015-03-04 16:02:03 +05:30
parent 31724da2d6
commit 95ff2d4fed
2 changed files with 24 additions and 14 deletions

View File

@@ -48,16 +48,6 @@
"options": "Cost Center", "options": "Cost Center",
"permlevel": 0 "permlevel": 0
}, },
{
"fieldname": "rate",
"fieldtype": "Float",
"in_list_view": 1,
"label": "Rate",
"oldfieldname": "rate",
"oldfieldtype": "Currency",
"permlevel": 0,
"reqd": 0
},
{ {
"fieldname": "col_break_1", "fieldname": "col_break_1",
"fieldtype": "Column Break", "fieldtype": "Column Break",
@@ -89,6 +79,22 @@
"report_hide": 1, "report_hide": 1,
"width": "150px" "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", "fieldname": "section_break_9",
"fieldtype": "Section Break", "fieldtype": "Section Break",
@@ -186,7 +192,7 @@
"hide_heading": 1, "hide_heading": 1,
"idx": 1, "idx": 1,
"istable": 1, "istable": 1,
"modified": "2015-02-25 02:50:44.152307", "modified": "2015-03-04 15:16:30.732876",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Sales Taxes and Charges", "name": "Sales Taxes and Charges",

View File

@@ -232,6 +232,8 @@ class calculate_taxes_and_totals(object):
and self.doc.discount_amount: and self.doc.discount_amount:
self.adjust_discount_amount_loss(tax) self.adjust_discount_amount_loss(tax)
def get_current_tax_amount(self, item, tax, item_tax_map): def get_current_tax_amount(self, item, tax, item_tax_map):
tax_rate = self._get_tax_rate(tax, item_tax_map) tax_rate = self._get_tax_rate(tax, item_tax_map)
current_tax_amount = 0.0 current_tax_amount = 0.0
@@ -275,8 +277,10 @@ class calculate_taxes_and_totals(object):
def adjust_discount_amount_loss(self, tax): def adjust_discount_amount_loss(self, tax):
discount_amount_loss = self.doc.grand_total - flt(self.doc.discount_amount) - tax.total 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 + tax.tax_amount_after_discount_amount = flt(tax.tax_amount_after_discount_amount +
discount_amount_loss, self.doc.precision("tax_amount", tax)) discount_amount_loss, tax.precision("tax_amount"))
tax.total = flt(tax.total + discount_amount_loss, self.doc.precision("total", tax)) 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): def calculate_totals(self):
self.doc.grand_total = flt(self.doc.get("taxes")[-1].total self.doc.grand_total = flt(self.doc.get("taxes")[-1].total