Dont display old fraction outstanding in AR report
diff --git a/accounts/report/accounts_receivable/accounts_receivable.py b/accounts/report/accounts_receivable/accounts_receivable.py
index de96abb..c826fcb 100644
--- a/accounts/report/accounts_receivable/accounts_receivable.py
+++ b/accounts/report/accounts_receivable/accounts_receivable.py
@@ -37,12 +37,15 @@
return columns
def get_data(self, customer_naming_by):
+ from accounts.utils import get_currency_precision
+ currency_precision = get_currency_precision() or 2
+
data = []
future_vouchers = self.get_entries_after(self.filters.report_date)
for gle in self.get_entries_till(self.filters.report_date):
if self.is_receivable(gle, future_vouchers):
outstanding_amount = self.get_outstanding_amount(gle, self.filters.report_date)
- if abs(outstanding_amount) > 0.0:
+ if abs(outstanding_amount) > 0.1/10**currency_precision:
due_date = self.get_due_date(gle)
invoiced_amount = gle.debit if (gle.debit > 0) else 0
payment_received = invoiced_amount - outstanding_amount
diff --git a/accounts/utils.py b/accounts/utils.py
index fdd57b3..a3557ae 100644
--- a/accounts/utils.py
+++ b/accounts/utils.py
@@ -378,4 +378,13 @@
account_for_field = "account_type"
return webnotes.conn.get_value("Account", {account_for_field: account_for_doctype,
- "master_name": account_for})
\ No newline at end of file
+ "master_name": account_for})
+
+def get_currency_precision(currency=None):
+ if not currency:
+ currency = webnotes.conn.get_value("Company",
+ webnotes.conn.get_default("company"), "default_currency")
+ currency_format = webnotes.conn.get_value("Currency", currency, "number_format")
+
+ from webnotes.utils import get_number_format_info
+ return get_number_format_info(currency_format)[2]
\ No newline at end of file