[fix] Rounding adjustment in company currency

This commit is contained in:
Nabin Hait 2017-11-22 16:12:20 +05:30
parent 036bf6de6e
commit 02ac901345
2 changed files with 2 additions and 18 deletions

View File

@ -341,15 +341,7 @@ class calculate_taxes_and_totals(object):
self.doc.rounding_adjustment += flt(self.doc.rounded_total - self.doc.grand_total, self.doc.rounding_adjustment += flt(self.doc.rounded_total - self.doc.grand_total,
self.doc.precision("rounding_adjustment")) self.doc.precision("rounding_adjustment"))
if self.doc.meta.get_field("base_rounded_total"): self._set_in_company_currency(self.doc, ["rounding_adjustment", "rounded_total"])
company_currency = erpnext.get_company_currency(self.doc.company)
self.doc.base_rounded_total = \
round_based_on_smallest_currency_fraction(self.doc.base_grand_total,
company_currency, self.doc.precision("base_rounded_total"))
self.doc.base_rounding_adjustment += flt(self.doc.base_rounded_total - self.doc.base_grand_total,
self.doc.precision("base_rounding_adjustment"))
def _cleanup(self): def _cleanup(self):
for tax in self.doc.get("taxes"): for tax in self.doc.get("taxes"):

View File

@ -443,16 +443,8 @@ erpnext.taxes_and_totals = erpnext.payments.extend({
this.frm.doc.currency, precision("rounded_total")); this.frm.doc.currency, precision("rounded_total"));
this.frm.doc.rounding_adjustment += flt(this.frm.doc.rounded_total - this.frm.doc.grand_total, this.frm.doc.rounding_adjustment += flt(this.frm.doc.rounded_total - this.frm.doc.grand_total,
precision("rounding_adjustment")); precision("rounding_adjustment"));
}
if(frappe.meta.get_docfield(this.frm.doc.doctype, "base_rounded_total", this.frm.doc.name)) {
var company_currency = this.get_company_currency();
this.frm.doc.base_rounded_total = this.set_in_company_currency(this.frm.doc, ["rounding_adjustment", "rounded_total"]);
round_based_on_smallest_currency_fraction(this.frm.doc.base_grand_total,
company_currency, precision("base_rounded_total"));
this.frm.doc.base_rounding_adjustment += flt(this.frm.doc.base_rounded_total -
this.frm.doc.base_grand_total, precision("rounding_adjustment"));
} }
}, },