From bcd0105915ddd7fc433f8de5f743a16023d99748 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Tue, 8 Oct 2024 09:01:25 +0530 Subject: [PATCH] chore: Allow apps to extend voucher subtypes (#43528) * chore: Allow apps to extend voucher subtypes (cherry picked from commit a1525d9b8e45c6b71f1a9e490af82e2e84b09c25) * chore: Allow apps to extend voucher subtypes (cherry picked from commit 8a1e38a43b8f47ef388a5d7f57b8e84212bbe2b3) * chore: Allow apps to extend voucher subtypes (cherry picked from commit ca8820b5660f371ec9bd05ac6afe104c55168b18) --------- Co-authored-by: Deepesh Garg --- erpnext/controllers/accounts_controller.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index 9a590ef2e40..73923464ed9 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -1063,6 +1063,13 @@ class AccountsController(TransactionBase): "Stock Entry": "stock_entry_type", "Asset Capitalization": "entry_type", } + + for method_name in frappe.get_hooks("voucher_subtypes"): + voucher_subtype = frappe.get_attr(method_name)(self) + + if voucher_subtype: + return voucher_subtype + if self.doctype in voucher_subtypes: return self.get(voucher_subtypes[self.doctype]) elif self.doctype == "Purchase Receipt" and self.is_return: @@ -1073,6 +1080,7 @@ class AccountsController(TransactionBase): return "Credit Note" elif (self.doctype == "Purchase Invoice" and self.is_return) or self.doctype == "Sales Invoice": return "Debit Note" + return self.doctype def get_value_in_transaction_currency(self, account_currency, gl_dict, field):