Skip to content

Commit 7032197

Browse files
feat(Journal Entry Account): add Bank Transaction as Reference Type (backport #52760) (#52815)
* 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 387fb1b) # Conflicts: # erpnext/accounts/doctype/journal_entry_account/journal_entry_account.json # erpnext/patches.txt * chore: resolve conflicts --------- Co-authored-by: Raffael Meyer <14891507+barredterra@users.noreply.github.com>
1 parent ef801d6 commit 7032197

5 files changed

Lines changed: 40 additions & 3 deletions

File tree

erpnext/accounts/doctype/bank_transaction/bank_transaction.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ def before_update_after_submit(self):
136136
self.set_status()
137137

138138
def on_cancel(self):
139+
self.ignore_linked_doctypes = ["GL Entry"]
140+
139141
for payment_entry in self.payment_entries:
140142
self.delink_payment_entry(payment_entry)
141143

erpnext/accounts/doctype/journal_entry_account/journal_entry_account.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@
185185
"fieldtype": "Select",
186186
"label": "Reference Type",
187187
"no_copy": 1,
188-
"options": "\nSales Invoice\nPurchase Invoice\nJournal Entry\nSales Order\nPurchase Order\nExpense Claim\nAsset\nLoan\nPayroll Entry\nEmployee Advance\nExchange Rate Revaluation\nInvoice Discounting\nFees\nFull and Final Statement\nPayment Entry",
188+
"options": "\nSales Invoice\nPurchase Invoice\nJournal Entry\nSales Order\nPurchase Order\nExpense Claim\nAsset\nLoan\nPayroll Entry\nEmployee Advance\nExchange Rate Revaluation\nInvoice Discounting\nFees\nFull and Final Statement\nPayment Entry\nBank Transaction",
189189
"search_index": 1
190190
},
191191
{
@@ -198,7 +198,7 @@
198198
"search_index": 1
199199
},
200200
{
201-
"depends_on": "eval:doc.reference_type&&!in_list(doc.reference_type, ['Expense Claim', 'Asset', 'Employee Loan', 'Employee Advance'])",
201+
"depends_on": "eval:doc.reference_type&&!in_list(doc.reference_type, ['Expense Claim', 'Asset', 'Employee Loan', 'Employee Advance', 'Bank Transaction'])",
202202
"fieldname": "reference_due_date",
203203
"fieldtype": "Date",
204204
"label": "Reference Due Date",
@@ -295,7 +295,7 @@
295295
"idx": 1,
296296
"istable": 1,
297297
"links": [],
298-
"modified": "2025-11-27 12:23:33.157655",
298+
"modified": "2026-02-19 17:01:22.642454",
299299
"modified_by": "Administrator",
300300
"module": "Accounts",
301301
"name": "Journal Entry Account",

erpnext/accounts/doctype/journal_entry_account/journal_entry_account.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ class JournalEntryAccount(Document):
5555
"Fees",
5656
"Full and Final Statement",
5757
"Payment Entry",
58+
"Bank Transaction",
5859
]
5960
user_remark: DF.SmallText | None
6061
# end: auto-generated types

erpnext/patches.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,7 @@ erpnext.patches.v15_0.update_payment_schedule_fields_in_invoices
406406
erpnext.patches.v15_0.rename_group_by_to_categorize_by
407407
execute:frappe.db.set_single_value("Accounts Settings", "receivable_payable_fetch_method", "Buffered Cursor")
408408
erpnext.patches.v14_0.set_update_price_list_based_on
409+
erpnext.patches.v15_0.add_bank_transaction_as_journal_entry_reference
409410
erpnext.patches.v15_0.set_cancelled_status_to_cancelled_pos_invoice
410411
erpnext.patches.v15_0.rename_group_by_to_categorize_by_in_custom_reports
411412
erpnext.patches.v14_0.update_full_name_in_contract
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import frappe
2+
3+
4+
def execute():
5+
"""Append Bank Transaction in custom reference_type options."""
6+
new_reference_type = "Bank Transaction"
7+
property_setters = frappe.get_all(
8+
"Property Setter",
9+
filters={
10+
"doc_type": "Journal Entry Account",
11+
"field_name": "reference_type",
12+
"property": "options",
13+
},
14+
pluck="name",
15+
)
16+
17+
for property_setter in property_setters:
18+
existing_value = frappe.db.get_value("Property Setter", property_setter, "value") or ""
19+
20+
raw_options = [option.strip() for option in existing_value.split("\n")]
21+
# Preserve a single leading blank (for the empty select option) but drop spurious trailing blanks
22+
options = raw_options[:1] + [o for o in raw_options[1:] if o]
23+
24+
if new_reference_type in options:
25+
continue
26+
27+
options.append(new_reference_type)
28+
frappe.db.set_value(
29+
"Property Setter",
30+
property_setter,
31+
"value",
32+
"\n".join(options),
33+
)

0 commit comments

Comments
 (0)