fix: override Payment Reconciliation account filter for Student party type#6
Open
av-dev2 wants to merge 2 commits into
Open
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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):
that derives root_type dynamically from frappe.boot.party_account_types:
any party type with account_type="Receivable" → Asset, else Liability
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.