diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index e9c6c84184..431eab5924 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -364,7 +364,7 @@ class AccountsController(TransactionBase): diff = self.net_total_export - flt(last_tax.total / self.conversion_rate, self.precision("grand_total_export")) - if diff: + if diff and abs(diff) <= (2.0 / 10**(self.precision("total", last_tax))): last_tax.total = last_tax.total + flt(diff * self.conversion_rate, self.precision("total", last_tax)) def calculate_total_advance(self, parenttype, advance_parentfield): diff --git a/erpnext/selling/sales_common.js b/erpnext/selling/sales_common.js index 6fdfeae876..f440315d91 100644 --- a/erpnext/selling/sales_common.js +++ b/erpnext/selling/sales_common.js @@ -471,7 +471,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ var diff = this.frm.doc.net_total_export - flt(last_tax.total / this.frm.doc.conversion_rate, precision("grand_total_export")); - if (diff) { + if ( diff && Math.abs(diff) <= (2.0 / Math.pow(10, precision("total", last_tax)) ) { last_tax.total += flt(diff * this.frm.doc.conversion_rate, precision("total", last_tax)); } }