From 836545bdb4243ac13637799932e5b9c8fee5a62f Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 22 Aug 2025 19:17:44 +0200 Subject: [PATCH] feat: add make methods for Bank Account (backport #49000) (#49274) Co-authored-by: Raffael Meyer <14891507+barredterra@users.noreply.github.com> --- erpnext/buying/doctype/supplier/supplier.js | 4 ++++ erpnext/public/js/utils.js | 14 +++----------- erpnext/selling/doctype/customer/customer.js | 1 + erpnext/setup/doctype/employee/employee.js | 6 ++++++ 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/erpnext/buying/doctype/supplier/supplier.js b/erpnext/buying/doctype/supplier/supplier.js index 23f25b28876..58e084e4cf8 100644 --- a/erpnext/buying/doctype/supplier/supplier.js +++ b/erpnext/buying/doctype/supplier/supplier.js @@ -42,6 +42,10 @@ frappe.ui.form.on("Supplier", { }, }; }); + + frm.make_methods = { + "Bank Account": () => erpnext.utils.make_bank_account(frm.doc.doctype, frm.doc.name), + }; }, refresh: function (frm) { diff --git a/erpnext/public/js/utils.js b/erpnext/public/js/utils.js index 44cd291004b..c3a3d014dde 100755 --- a/erpnext/public/js/utils.js +++ b/erpnext/public/js/utils.js @@ -215,17 +215,9 @@ $.extend(erpnext.utils, { }, make_bank_account: function (doctype, docname) { - frappe.call({ - method: "erpnext.accounts.doctype.bank_account.bank_account.make_bank_account", - args: { - doctype: doctype, - docname: docname, - }, - freeze: true, - callback: function (r) { - var doclist = frappe.model.sync(r.message); - frappe.set_route("Form", doclist[0].doctype, doclist[0].name); - }, + frappe.new_doc("Bank Account", { + party_type: doctype, + party: docname, }); }, diff --git a/erpnext/selling/doctype/customer/customer.js b/erpnext/selling/doctype/customer/customer.js index 956206712a3..0398ff6f062 100644 --- a/erpnext/selling/doctype/customer/customer.js +++ b/erpnext/selling/doctype/customer/customer.js @@ -14,6 +14,7 @@ frappe.ui.form.on("Customer", { method: "erpnext.selling.doctype.customer.customer.make_opportunity", frm: cur_frm, }), + "Bank Account": () => erpnext.utils.make_bank_account(frm.doc.doctype, frm.doc.name), }; frm.add_fetch("lead_name", "company_name", "customer_name"); diff --git a/erpnext/setup/doctype/employee/employee.js b/erpnext/setup/doctype/employee/employee.js index 7a1efa82fa0..2e45d5511b3 100755 --- a/erpnext/setup/doctype/employee/employee.js +++ b/erpnext/setup/doctype/employee/employee.js @@ -21,6 +21,12 @@ erpnext.setup.EmployeeController = class EmployeeController extends frappe.ui.fo }; frappe.ui.form.on("Employee", { + setup: function (frm) { + frm.make_methods = { + "Bank Account": () => erpnext.utils.make_bank_account(frm.doc.doctype, frm.doc.name), + }; + }, + onload: function (frm) { frm.set_query("department", function () { return {