Skip to content

Commit

Permalink
fix: show purchase returns in check run (#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
agritheory authored Jul 28, 2023
1 parent 9c2ded2 commit b1cd85b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion check_run/check_run/doctype/check_run/check_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
15 changes: 14 additions & 1 deletion check_run/test_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b1cd85b

Please sign in to comment.