refactor: move payment_document query to setup

(cherry picked from commit 257802aeda)

# Conflicts:
#	erpnext/accounts/doctype/bank_transaction/bank_transaction.js
This commit is contained in:
Abdeali Chharchhoda
2025-03-20 15:12:06 +05:30
committed by Mergify
parent 36aa308bce
commit a19eece881

View File

@@ -2,7 +2,15 @@
// For license information, please see license.txt
frappe.ui.form.on("Bank Transaction", {
onload(frm) {
setup: function (frm) {
frm.set_query("party_type", function () {
return {
filters: {
name: ["in", Object.keys(frappe.boot.party_account_types)],
},
};
});
frm.set_query("payment_document", "payment_entries", function () {
const payment_doctypes = frm.events.get_payment_doctypes(frm);
return {
@@ -12,6 +20,7 @@ frappe.ui.form.on("Bank Transaction", {
};
});
},
refresh(frm) {
if (!frm.is_dirty() && frm.doc.payment_entries.length > 0) {
frm.add_custom_button(__("Unreconcile Transaction"), () => {
@@ -19,10 +28,12 @@ frappe.ui.form.on("Bank Transaction", {
});
}
},
bank_account: function (frm) {
set_bank_statement_filter(frm);
},
<<<<<<< HEAD
setup: function (frm) {
frm.set_query("party_type", function () {
return {
@@ -39,6 +50,8 @@ frappe.ui.form.on("Bank Transaction", {
});
},
=======
>>>>>>> 257802aeda (refactor: move `payment_document` query to `setup`)
get_payment_doctypes: function () {
// get payment doctypes from all the apps
return ["Payment Entry", "Journal Entry", "Sales Invoice", "Purchase Invoice", "Bank Transaction"];