diff --git a/check_run/check_run/doctype/check_run/check_run.py b/check_run/check_run/doctype/check_run/check_run.py index c20eddb2..49460d7e 100644 --- a/check_run/check_run/doctype/check_run/check_run.py +++ b/check_run/check_run/doctype/check_run/check_run.py @@ -497,7 +497,7 @@ def get_entries(doc): "\n", ).as_("mode_of_payment"), ) - .where(purchase_invoices.outstanding_amount > 0) + .where(purchase_invoices.outstanding_amount != 0) .where(purchase_invoices.company == company) .where(purchase_invoices.docstatus == 1) .where(purchase_invoices.credit_to == pay_to_account) diff --git a/check_run/test_setup.py b/check_run/test_setup.py index ca920ef0..f85eb7c2 100644 --- a/check_run/test_setup.py +++ b/check_run/test_setup.py @@ -5,6 +5,7 @@ from frappe.desk.page.setup_wizard.setup_wizard import setup_complete from erpnext.setup.utils import enable_all_roles_and_domains, set_defaults_for_tests from erpnext.accounts.doctype.account.account import update_account_number +from erpnext.accounts.doctype.purchase_invoice.purchase_invoice import make_debit_note def before_test(): @@ -394,7 +395,6 @@ def setup_accounts(): update_account_number("Primary Checking - CFC", "Primary Checking", account_number="1201") - def create_payment_terms_templates(settings): if not frappe.db.exists("Payment Terms Template", "Net 30"): doc = frappe.new_doc("Payment Terms Template") @@ -624,6 +624,19 @@ def create_invoices(settings): pi.save() pi.submit() + spi = frappe.get_value( + "Purchase Invoice", + {"supplier": "Cooperative Ag Finance"}, + order_by="posting_date DESC", + ) + rpi = make_debit_note(spi) + rpi.return_against = ( + None # this approach isn't best practice but it allows us to see a negative PI in the check run + ) + rpi.items[0].rate = 500 + rpi.save() + rpi.submit() + def validate_release_date(self): pass