rounding issue and rate trigger

This commit is contained in:
Nabin Hait
2015-02-24 17:08:34 +05:30
parent b620fed762
commit 93b3a37a3b
5 changed files with 8 additions and 19 deletions

View File

@@ -387,5 +387,5 @@ def validate_inclusive_tax(tax, doc):
not all([cint(t.included_in_print_rate) for t in doc.get("taxes")[:cint(tax.row_id) - 1]]):
# all rows about the reffered tax should be inclusive
_on_previous_row_error("1 - %d" % (tax.row_id,))
elif tax.category == "Valuation":
elif tax.get("category") == "Valuation":
frappe.throw(_("Valuation type charges can not marked as Inclusive"))

View File

@@ -214,10 +214,10 @@ class calculate_taxes_and_totals(object):
# note: grand_total_for_current_item contains the contribution of
# item's amount, previously applied tax and the current tax on that item
if i==0:
tax.grand_total_for_current_item = flt(item.net_amount + current_tax_amount)
tax.grand_total_for_current_item = flt(item.net_amount + current_tax_amount, tax.precision("total"))
else:
tax.grand_total_for_current_item = \
self.doc.get("taxes")[i-1].grand_total_for_current_item + current_tax_amount
flt(self.doc.get("taxes")[i-1].grand_total_for_current_item + current_tax_amount, tax.precision("total_taxes_and_charges"))
# in tax.total, accumulate grand total of each item
tax.total += tax.grand_total_for_current_item
@@ -249,7 +249,7 @@ class calculate_taxes_and_totals(object):
current_tax_amount = (tax_rate / 100.0) * \
self.doc.get("taxes")[cint(tax.row_id) - 1].grand_total_for_current_item
# current_tax_amount = flt(current_tax_amount, tax.precision("tax_amount", tax))
current_tax_amount = flt(current_tax_amount, tax.precision("tax_amount"))
self.set_item_wise_tax(item, tax, tax_rate, current_tax_amount)