Skip to content

fix: override Payment Reconciliation account filter for Student party type#6

Open
av-dev2 wants to merge 2 commits into
Aakvatech-Limited:version-15-hotfixfrom
av-dev2:fix_filtering_for_student
Open

fix: override Payment Reconciliation account filter for Student party type#6
av-dev2 wants to merge 2 commits into
Aakvatech-Limited:version-15-hotfixfrom
av-dev2:fix_filtering_for_student

Conversation

@av-dev2

@av-dev2 av-dev2 commented May 26, 2026

Copy link
Copy Markdown
Contributor

ERPNext core hard-codes root_type = "Asset" only when party_type ==
"Customer", causing the Student party type to incorrectly filter the
Receivable/Payable Account field to Liability accounts. This hides
Asset-root receivable accounts like "Debtors - SHMPS" from the dropdown.
Fix via edu_tz doctype_js hook (non-invasive, preserves upstream erpnext):

  • Add public/js/payment_reconciliation.js with a refresh event override
    that derives root_type dynamically from frappe.boot.party_account_types:
    any party type with account_type="Receivable" → Asset, else Liability
  • Register the override in hooks.py via doctype_js
    The refresh event is used instead of onload because ERPNext's class
    controller (extend_cscript) executes its onload() after frappe.ui.form.on
    onload handlers, which would overwrite the override. Using refresh ensures
    our set_query runs last and persists.
    Tested: "Debtors - SHMPS" (Asset, Receivable) now appears correctly in
    the dropdown when Party Type = Student.

av-dev2 added 2 commits May 26, 2026 17:50
…t as Asset

ERPNext core hard-codes root_type filter as 'Asset' only when
party_type == 'Customer'. This excludes 'Student' party type which also
has account_type='Receivable' and uses Asset-root accounts like
'Debtors - SHMPS'.

Override via doctype_js hook to dynamically derive root_type from the
party type's account_type in frappe.boot.party_account_types, so any
Receivable party type (Customer, Student) correctly filters to Asset
accounts and any Payable party type filters to Liability accounts.
ERPNext's class controller (extend_cscript) onload() runs AFTER
frappe.ui.form.on onload handlers, so the core filter overwrote ours.
Using refresh event ensures our set_query runs last and wins.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant