From a2057331e309da6605f625b5c09f0eb4503011bc Mon Sep 17 00:00:00 2001 From: khushi8112 Date: Mon, 23 Mar 2026 01:41:12 +0530 Subject: [PATCH] fix: party name not updating correctly (cherry picked from commit 469bb0ba4e94809a11871f402861f5fe0039759f) --- .../opening_invoice_creation_tool.js | 3 ++- .../opening_invoice_creation_tool.py | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.js b/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.js index 2f2b9e876a8..466b38126d7 100644 --- a/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.js +++ b/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.js @@ -124,7 +124,8 @@ frappe.ui.form.on("Opening Invoice Creation Tool", { invoice_type: function (frm) { $.each(frm.doc.invoices, (idx, row) => { row.party_type = frm.doc.invoice_type == "Sales" ? "Customer" : "Supplier"; - row.party = ""; + frappe.model.set_value(row.doctype, row.name, "party", ""); + frappe.model.set_value(row.doctype, row.name, "party_name", ""); }); frm.refresh_fields(); }, diff --git a/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.py b/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.py index 04d9bd544f6..6a3df141f52 100644 --- a/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.py +++ b/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.py @@ -108,11 +108,10 @@ class OpeningInvoiceCreationTool(Document): frappe.throw(_("Row #{}: Either Party ID or Party Name is required").format(row.idx)) if not row.party and row.party_name: - self.add_party(row.party_type, row.party_name) - row.party = row.party_name + row.party = self.add_party(row.party_type, row.party_name) if row.party and not frappe.db.exists(row.party_type, row.party): - self.add_party(row.party_type, row.party) + row.party = self.add_party(row.party_type, row.party) else: if not row.party: @@ -171,6 +170,7 @@ class OpeningInvoiceCreationTool(Document): party_doc.flags.ignore_mandatory = True party_doc.save(ignore_permissions=True) + return party_doc.name def get_invoice_dict(self, row=None): def get_item_dict():