Skip to content

Commit

Permalink
fix: show purchase returns in list (#130)
Browse files Browse the repository at this point in the history
  • Loading branch information
agritheory authored Jul 28, 2023
1 parent 45c9598 commit c504828
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
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 @@ -520,7 +520,7 @@ def get_entries(doc):
`tabPurchase Invoice`.posting_date,
COALESCE(`tabPurchase Invoice`.supplier_default_mode_of_payment, `tabSupplier`.supplier_default_mode_of_payment, '\n') AS mode_of_payment
FROM `tabPurchase Invoice`, `tabSupplier`
WHERE `tabPurchase Invoice`.outstanding_amount > 0
WHERE `tabPurchase Invoice`.outstanding_amount != 0
AND `tabPurchase Invoice`.supplier = `tabSupplier`.name
AND `tabPurchase Invoice`.company = %(company)s
AND `tabPurchase Invoice`.docstatus = 1
Expand Down
14 changes: 14 additions & 0 deletions 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 @@ -594,6 +595,7 @@ def create_invoices(settings):
)
pi.save()
pi.submit()

# two electric meters / test invoice aggregation
pi = frappe.new_doc("Purchase Invoice")
pi.company = settings.company
Expand Down Expand Up @@ -652,6 +654,18 @@ def create_invoices(settings):
pi.save()
pi.submit()

# this example
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 c504828

Please sign in to comment.