File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -82,7 +82,7 @@ bench --site [sitename] uninstall-app banking
8282 - ` unpaid_vouchers.py ` : Payment Entry/Journal Entry creation
8383
8484** ` banking/overrides/ ` ** - ERPNext DocType customizations
85- - ` bank_transaction.py ` : Enhanced reconciliation validation (CustomBankTransaction)
85+ - ` bank_transaction.py ` : Enhanced reconciliation validation (` CustomBankTransaction ` , mixed in via ` extend_doctype_class ` )
8686- ` bank_account.py ` : IBAN validation hooks
8787
8888** ` banking/connectors/ ` ** - External service communication
@@ -174,7 +174,7 @@ Tests run against ERPNext's shipped `_Test Company` (INR). Inherit from `frappe.
174174
175175### Hooks Configuration
176176Key hooks in ` hooks.py ` :
177- - ` override_doctype_class ` : Replace Bank Transaction with CustomBankTransaction
177+ - ` extend_doctype_class ` : Mix ` CustomBankTransaction ` into Bank Transaction (preferred over ` override_doctype_class ` in v16+)
178178- ` doc_events ` : Validation and status change hooks
179179- ` bank_reconciliation_doctypes ` : Register Bank Transaction for reconciliation
180180- ` get_matching_queries ` : Point to custom matching logic
Original file line number Diff line number Diff line change 101101
102102# DocType Class
103103# ---------------
104- # Override standard doctype classes
104+ # Extend standard doctype classes
105105
106- override_doctype_class = {"Bank Transaction" : "banking.overrides.bank_transaction.CustomBankTransaction" }
106+ extend_doctype_class = {
107+ "Bank Transaction" : ["banking.overrides.bank_transaction.CustomBankTransaction" ],
108+ }
107109
108110# Document Events
109111# ---------------
Original file line number Diff line number Diff line change 99
1010
1111class CustomBankTransaction (BankTransaction ):
12+ """Mixin applied to **Bank Transaction** via the `extend_doctype_class` hook.
13+
14+ Inherits from `BankTransaction` so type checkers and IDEs can resolve all
15+ DocType fields and inherited methods. At runtime Frappe builds a class
16+ `ExtendedBankTransaction(CustomBankTransaction, BankTransaction)`; the
17+ resulting MRO is well-defined (classic diamond) and `super()` calls from
18+ this mixin still chain into the original `BankTransaction` methods.
19+ """
20+
1221 def before_validate (self ):
1322 """Normalize imported signs before ERPNext computes fees and balances.
1423
You can’t perform that action at this time.
0 commit comments