feat(Journal Entry Account): add Bank Transaction as Reference Type (backport #52760) (#52816)

* feat: add Bank Transaction as Reference Type to Journal Entry Account (#52760)

* feat: add Bank Transaction as Reference Type to Journal Entry Account

* fix: take care of existing property setters

* fix: cancelling Bank Transactions should still be possible

* fix: handle blank options in patch

* fix: hide Reference Due Date for Bank Transaction

(cherry picked from commit 387fb1b202)

# Conflicts:
#	erpnext/accounts/doctype/journal_entry_account/journal_entry_account.json

* chore: resolve conflicts

---------

Co-authored-by: Raffael Meyer <14891507+barredterra@users.noreply.github.com>
This commit is contained in:
mergify[bot]
2026-02-21 15:43:47 +01:00
committed by GitHub
parent a4ee85e89c
commit 2c5bdefd13
5 changed files with 40 additions and 3 deletions

View File

@@ -0,0 +1,33 @@
import frappe
def execute():
"""Append Bank Transaction in custom reference_type options."""
new_reference_type = "Bank Transaction"
property_setters = frappe.get_all(
"Property Setter",
filters={
"doc_type": "Journal Entry Account",
"field_name": "reference_type",
"property": "options",
},
pluck="name",
)
for property_setter in property_setters:
existing_value = frappe.db.get_value("Property Setter", property_setter, "value") or ""
raw_options = [option.strip() for option in existing_value.split("\n")]
# Preserve a single leading blank (for the empty select option) but drop spurious trailing blanks
options = raw_options[:1] + [o for o in raw_options[1:] if o]
if new_reference_type in options:
continue
options.append(new_reference_type)
frappe.db.set_value(
"Property Setter",
property_setter,
"value",
"\n".join(options),
)