diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py index 4bc78921b5b3e89d3a9606d9e4377c24537f9317..780349e463c4ca1a13b6eb1038788b7983762395 100644 --- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py +++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py @@ -292,13 +292,13 @@ class ReceivablePayableReport(object): must_consider = False if self.filters.get("for_revaluation_journals"): - if (abs(row.outstanding) > 0.0 / 10**self.currency_precision) or ( - (abs(row.outstanding_in_account_currency) > 0.0 / 10**self.currency_precision) + if (abs(row.outstanding) >= 0.0 / 10**self.currency_precision) or ( + abs(row.outstanding_in_account_currency) >= 0.0 / 10**self.currency_precision ): must_consider = True else: - if (abs(row.outstanding) > 1.0 / 10**self.currency_precision) and ( - (abs(row.outstanding_in_account_currency) > 1.0 / 10**self.currency_precision) + if (abs(row.outstanding) >= 1.0 / 10**self.currency_precision) and ( + (abs(row.outstanding_in_account_currency) >= 1.0 / 10**self.currency_precision) or (row.voucher_no in self.err_journals) ): must_consider = True diff --git a/erpnext/accounts/report/accounts_receivable/test_accounts_receivable.py b/erpnext/accounts/report/accounts_receivable/test_accounts_receivable.py index 7a0a035b32f6fd388108cba9c8bac2726a7a3c4b..8e38d28d2c4ee4f56c4025aac20c0f4f2726cf3d 100644 --- a/erpnext/accounts/report/accounts_receivable/test_accounts_receivable.py +++ b/erpnext/accounts/report/accounts_receivable/test_accounts_receivable.py @@ -316,9 +316,7 @@ class TestAccountsReceivable(AccountsTestMixin, FrappeTestCase): err.extend("accounts", accounts) err.accounts[0].new_exchange_rate = 85 row = err.accounts[0] - row.new_balance_in_base_currency = flt( - row.new_exchange_rate * flt(row.balance_in_account_currency) - ) + row.new_balance_in_base_currency = flt(row.new_exchange_rate * flt(row.balance_in_account_currency)) row.gain_loss = row.new_balance_in_base_currency - flt(row.balance_in_base_currency) err.set_total_gain_loss() err = err.save().submit() @@ -782,9 +780,7 @@ class TestAccountsReceivable(AccountsTestMixin, FrappeTestCase): def test_report_output_if_party_is_missing(self): acc_name = "Additional Debtors" - if not frappe.db.get_value( - "Account", filters={"account_name": acc_name, "company": self.company} - ): + if not frappe.db.get_value("Account", filters={"account_name": acc_name, "company": self.company}): additional_receivable_acc = frappe.get_doc( { "doctype": "Account", @@ -959,3 +955,32 @@ class TestAccountsReceivable(AccountsTestMixin, FrappeTestCase): self.assertEqual( expected_data, [row.invoiced, row.outstanding, row.remaining_balance, row.future_amount] ) + + def test_accounts_receivable_output_for_minor_outstanding(self): + """ + AR/AP should report miniscule outstanding of 0.01. Or else there will be slight difference with General Ledger/Trial Balance + """ + filters = { + "company": self.company, + "report_date": today(), + "range1": 30, + "range2": 60, + "range3": 90, + "range4": 120, + } + + # check invoice grand total and invoiced column's value for 3 payment terms + si = self.create_sales_invoice(no_payment_schedule=True) + + pe = get_payment_entry("Sales Invoice", si.name, bank_account=self.cash, party_amount=99.99) + pe.paid_from = self.debit_to + pe.save().submit() + report = execute(filters) + + expected_data_after_payment = [100, 100, 99.99, 0.01] + self.assertEqual(len(report[1]), 1) + row = report[1][0] + self.assertEqual( + expected_data_after_payment, + [row.invoice_grand_total, row.invoiced, row.paid, row.outstanding], + ) diff --git a/erpnext/patches.txt b/erpnext/patches.txt index f3995ae9ae5c0d83b5d0527926f282734a5339b7..586e465026e16b9ac9c9fad629bdf858302470c7 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -215,7 +215,6 @@ erpnext.patches.v13_0.create_accounting_dimensions_for_asset_repair erpnext.patches.v15_0.delete_taxjar_doctypes erpnext.patches.v15_0.delete_ecommerce_doctypes execute:frappe.delete_doc("Module Def", "E Commerce", ignore_missing=True, force=True) -erpnext.patches.v15_0.create_asset_depreciation_schedules_from_assets erpnext.patches.v14_0.update_reference_due_date_in_journal_entry erpnext.patches.v15_0.saudi_depreciation_warning erpnext.patches.v15_0.delete_saudi_doctypes @@ -279,6 +278,7 @@ erpnext.patches.dokos.v4_0.migrate_integration_references_to_customer [post_model_sync] +erpnext.patches.v15_0.create_asset_depreciation_schedules_from_assets execute:frappe.delete_doc_if_exists('Workspace', 'ERPNext Integrations Settings') erpnext.patches.v14_0.update_posting_datetime_and_dropped_indexes #22-02-2024 erpnext.patches.v14_0.rename_ongoing_status_in_sla_documents #2022-08-19