[fix] [minor] _round function - implement round halfs to nearest even number

This commit is contained in:
Anand Doshi
2013-08-19 19:58:23 +05:30
parent c46d044efe
commit 2e31e097fa
5 changed files with 12 additions and 12 deletions

View File

@@ -4,7 +4,7 @@
from __future__ import unicode_literals
import webnotes
from webnotes import _, msgprint
from webnotes.utils import flt
from webnotes.utils import flt, _round
from buying.utils import get_item_details
from setup.utils import get_company_currency
@@ -129,10 +129,10 @@ class BuyingController(StockController):
self.precision("total_tax"))
if self.meta.get_field("rounded_total"):
self.doc.rounded_total = round(self.doc.grand_total)
self.doc.rounded_total = _round(self.doc.grand_total)
if self.meta.get_field("rounded_total_import"):
self.doc.rounded_total_import = round(self.doc.grand_total_import)
self.doc.rounded_total_import = _round(self.doc.grand_total_import)
def calculate_outstanding_amount(self):
if self.doc.doctype == "Purchase Invoice" and self.doc.docstatus < 2:

View File

@@ -3,7 +3,7 @@
from __future__ import unicode_literals
import webnotes
from webnotes.utils import cint, flt, comma_or
from webnotes.utils import cint, flt, comma_or, _round
from setup.utils import get_company_currency
from selling.utils import get_item_details
from webnotes import msgprint, _
@@ -218,8 +218,8 @@ class SellingController(StockController):
self.doc.other_charges_total_export = flt(self.doc.grand_total_export - self.doc.net_total_export,
self.precision("other_charges_total_export"))
self.doc.rounded_total = round(self.doc.grand_total)
self.doc.rounded_total_export = round(self.doc.grand_total_export)
self.doc.rounded_total = _round(self.doc.grand_total)
self.doc.rounded_total_export = _round(self.doc.grand_total_export)
def calculate_outstanding_amount(self):
# NOTE: