Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: show purchase returns in check run #131

Merged
merged 1 commit into from
Jul 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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