From 4fccef06363d1c2ceebcfecda4d569d13c4e5dfd Mon Sep 17 00:00:00 2001 From: ravibharathi656 Date: Fri, 22 Aug 2025 12:34:39 +0530 Subject: [PATCH 1/4] fix(dunning): include accounting dimension upon gl creation --- erpnext/accounts/doctype/dunning/dunning.py | 66 ++++++++++----------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/erpnext/accounts/doctype/dunning/dunning.py b/erpnext/accounts/doctype/dunning/dunning.py index a0206d424e2..749fc6c2639 100644 --- a/erpnext/accounts/doctype/dunning/dunning.py +++ b/erpnext/accounts/doctype/dunning/dunning.py @@ -55,46 +55,46 @@ class Dunning(AccountsController): "conversion_rate", "cost_center", ] - inv = frappe.db.get_value("Sales Invoice", self.sales_invoice, invoice_fields, as_dict=1) accounting_dimensions = get_accounting_dimensions() invoice_fields.extend(accounting_dimensions) + inv = frappe.db.get_value("Sales Invoice", self.sales_invoice, invoice_fields, as_dict=1) + dunning_in_company_currency = flt(self.dunning_amount * inv.conversion_rate) default_cost_center = frappe.get_cached_value("Company", self.company, "cost_center") - gl_entries.append( - self.get_gl_dict( - { - "account": inv.debit_to, - "party_type": "Customer", - "party": self.customer, - "due_date": self.due_date, - "against": self.income_account, - "debit": dunning_in_company_currency, - "debit_in_account_currency": self.dunning_amount, - "against_voucher": self.name, - "against_voucher_type": "Dunning", - "cost_center": inv.cost_center or default_cost_center, - "project": inv.project, - }, - inv.party_account_currency, - item=inv, - ) - ) - gl_entries.append( - self.get_gl_dict( - { - "account": self.income_account, - "against": self.customer, - "credit": dunning_in_company_currency, - "cost_center": inv.cost_center or default_cost_center, - "credit_in_account_currency": self.dunning_amount, - "project": inv.project, - }, - item=inv, - ) - ) + debit = { + "account": inv.debit_to, + "party_type": "Customer", + "party": self.customer, + "due_date": self.due_date, + "against": self.income_account, + "debit": dunning_in_company_currency, + "debit_in_account_currency": self.dunning_amount, + "against_voucher": self.name, + "against_voucher_type": "Dunning", + "cost_center": inv.cost_center or default_cost_center, + "project": inv.project, + } + + credit = { + "account": self.income_account, + "against": self.customer, + "credit": dunning_in_company_currency, + "credit_in_account_currency": self.dunning_amount, + "cost_center": inv.cost_center or default_cost_center, + "project": inv.project, + } + + for dimension in accounting_dimensions: + if val := inv.get(dimension): + debit[dimension] = credit[dimension] = val + + gl_entries = [ + self.get_gl_dict(debit, inv.party_account_currency, item=inv), + self.get_gl_dict(credit, item=inv), + ] make_gl_entries( gl_entries, cancel=(self.docstatus == 2), update_outstanding="No", merge_entries=False ) 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 2/4] 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 { From 7986e69839c1e8c81f4e63dbdceb3c179e122ea7 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 22 Aug 2025 19:26:10 +0200 Subject: [PATCH 3/4] fix(Supplier): add make_method for Pricing Rule (backport #49282) (#49283) Co-authored-by: Raffael Meyer <14891507+barredterra@users.noreply.github.com> fix(Supplier): add make_method for Pricing Rule (#49282) --- erpnext/buying/doctype/supplier/supplier.js | 1 + 1 file changed, 1 insertion(+) diff --git a/erpnext/buying/doctype/supplier/supplier.js b/erpnext/buying/doctype/supplier/supplier.js index 58e084e4cf8..c094dae10db 100644 --- a/erpnext/buying/doctype/supplier/supplier.js +++ b/erpnext/buying/doctype/supplier/supplier.js @@ -45,6 +45,7 @@ frappe.ui.form.on("Supplier", { frm.make_methods = { "Bank Account": () => erpnext.utils.make_bank_account(frm.doc.doctype, frm.doc.name), + "Pricing Rule": () => erpnext.utils.make_pricing_rule(frm.doc.doctype, frm.doc.name), }; }, From e27dd64044fa13a0811493bc27b6d8f98170035a Mon Sep 17 00:00:00 2001 From: niyati34 Date: Mon, 25 Aug 2025 19:35:18 +0530 Subject: [PATCH 4/4] fix(payment_entry): clear party_type when switching to Internal Transfer to avoid 'Supplier None not found' --- erpnext/accounts/doctype/payment_entry/payment_entry.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.js b/erpnext/accounts/doctype/payment_entry/payment_entry.js index 6c028eb0a4b..7c8d62fd7ef 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.js +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.js @@ -330,7 +330,7 @@ frappe.ui.form.on('Payment Entry', { payment_type: function(frm) { set_default_party_type(frm); if(frm.doc.payment_type == "Internal Transfer") { - $.each(["party", "party_balance", "paid_from", "paid_to", + $.each(["party", "party_type", "party_balance", "paid_from", "paid_to", "references", "total_allocated_amount"], function(i, field) { frm.set_value(field, null); });