Skip to content

Commit

Permalink
feat: check run settings
Browse files Browse the repository at this point in the history
 - include invoices, journal entries and expense claims discreetly
 - pre-check overdue items
 - number of invoices per voucher
 - ACH file extension and company description
 - ACH service class code and standard class code
 - allow/ disallow cancellation w/ unlinking
 - cascade cancellation to cancel payment entries
  • Loading branch information
agritheory committed Aug 23, 2022
1 parent 73ae78f commit 26c560d
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions check_run/check_run/doctype/check_run/check_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,21 @@ def validate(self):
else:
self.validate_last_check_number()

def on_cancel(self):
settings = get_check_run_settings(self)
if not settings.allow_cancellation:
frappe.throw(frappe._('The settings for this Check Run do not allow cancellation'))
if settings.allow_cancellation and settings.cascade_cancellation:
# cancel all PEs linked to this check run
pes = frappe.get_all('Payment Entry', {'check_run': self.name, 'docstatus': 1})
for pe in pes:
frappe.get_doc('Payment Entry', pe).cancel()
if settings.allow_cancellation and not settings.cascade_cancellation:
# unlink all PE's linked to this check run
pes = frappe.get_all('Payment Entry', {'check_run': self.name, 'docstatus': 1})
for pe in pes:
frappe.db.set_value('Payment Entry', pe, 'check_run', '')

def set_status(self, status=None):
if status:
self.status = status
Expand Down

0 comments on commit 26c560d

Please sign in to comment.