chore: Allow apps to extend voucher subtypes

This commit is contained in:
Deepesh Garg
2024-10-07 21:43:49 +05:30
parent e5d47c2337
commit a1525d9b8e

View File

@@ -1068,6 +1068,11 @@ class AccountsController(TransactionBase):
"Stock Entry": "stock_entry_type",
"Asset Capitalization": "entry_type",
}
extended_voucher_types = frappe.get_hooks("voucher_subtypes") or {}
for key, value in extended_voucher_types.items():
voucher_subtypes[key] = value[0]
if self.doctype in voucher_subtypes:
return self.get(voucher_subtypes[self.doctype])
elif self.doctype == "Purchase Receipt" and self.is_return:
@@ -1078,6 +1083,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):