mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-11 06:17:44 +00:00
* 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
# erpnext/patches.txt
* chore: resolve conflicts
---------
Co-authored-by: Raffael Meyer <14891507+barredterra@users.noreply.github.com>
This commit is contained in:
@@ -136,6 +136,8 @@ class BankTransaction(Document):
|
||||
self.set_status()
|
||||
|
||||
def on_cancel(self):
|
||||
self.ignore_linked_doctypes = ["GL Entry"]
|
||||
|
||||
for payment_entry in self.payment_entries:
|
||||
self.delink_payment_entry(payment_entry)
|
||||
|
||||
|
||||
@@ -185,7 +185,7 @@
|
||||
"fieldtype": "Select",
|
||||
"label": "Reference Type",
|
||||
"no_copy": 1,
|
||||
"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",
|
||||
"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",
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
@@ -198,7 +198,7 @@
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:doc.reference_type&&!in_list(doc.reference_type, ['Expense Claim', 'Asset', 'Employee Loan', 'Employee Advance'])",
|
||||
"depends_on": "eval:doc.reference_type&&!in_list(doc.reference_type, ['Expense Claim', 'Asset', 'Employee Loan', 'Employee Advance', 'Bank Transaction'])",
|
||||
"fieldname": "reference_due_date",
|
||||
"fieldtype": "Date",
|
||||
"label": "Reference Due Date",
|
||||
@@ -295,7 +295,7 @@
|
||||
"idx": 1,
|
||||
"istable": 1,
|
||||
"links": [],
|
||||
"modified": "2025-11-27 12:23:33.157655",
|
||||
"modified": "2026-02-19 17:01:22.642454",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Journal Entry Account",
|
||||
|
||||
@@ -55,6 +55,7 @@ class JournalEntryAccount(Document):
|
||||
"Fees",
|
||||
"Full and Final Statement",
|
||||
"Payment Entry",
|
||||
"Bank Transaction",
|
||||
]
|
||||
user_remark: DF.SmallText | None
|
||||
# end: auto-generated types
|
||||
|
||||
@@ -406,6 +406,7 @@ erpnext.patches.v15_0.update_payment_schedule_fields_in_invoices
|
||||
erpnext.patches.v15_0.rename_group_by_to_categorize_by
|
||||
execute:frappe.db.set_single_value("Accounts Settings", "receivable_payable_fetch_method", "Buffered Cursor")
|
||||
erpnext.patches.v14_0.set_update_price_list_based_on
|
||||
erpnext.patches.v15_0.add_bank_transaction_as_journal_entry_reference
|
||||
erpnext.patches.v15_0.set_cancelled_status_to_cancelled_pos_invoice
|
||||
erpnext.patches.v15_0.rename_group_by_to_categorize_by_in_custom_reports
|
||||
erpnext.patches.v14_0.update_full_name_in_contract
|
||||
|
||||
@@ -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),
|
||||
)
|
||||
Reference in New Issue
Block a user