chore: Allow apps to extend voucher subtypes (#43528)

* chore: Allow apps to extend voucher subtypes

(cherry picked from commit a1525d9b8e)

* chore: Allow apps to extend voucher subtypes

(cherry picked from commit 8a1e38a43b)

* chore: Allow apps to extend voucher subtypes

(cherry picked from commit ca8820b566)

---------

Co-authored-by: Deepesh Garg <deepeshgarg6@gmail.com>
This commit is contained in:
mergify[bot]
2024-10-08 09:01:25 +05:30
committed by GitHub
parent 225adf5cbc
commit bcd0105915

View File

@@ -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):