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 466b38126d7..22d977dd60f 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 @@ -70,9 +70,7 @@ frappe.ui.form.on("Opening Invoice Creation Tool", { }); }); - if (frm.doc.create_missing_party) { - frm.set_df_property("party", "fieldtype", "Data", frm.doc.name, "invoices"); - } + frm.trigger("update_party_labels"); }, setup_company_filters: function (frm) { @@ -127,7 +125,9 @@ frappe.ui.form.on("Opening Invoice Creation Tool", { frappe.model.set_value(row.doctype, row.name, "party", ""); frappe.model.set_value(row.doctype, row.name, "party_name", ""); }); + frm.clear_table("invoices"); frm.refresh_fields(); + frm.trigger("update_party_labels"); }, make_dashboard: function (frm) { @@ -175,6 +175,32 @@ frappe.ui.form.on("Opening Invoice Creation Tool", { } frm.refresh_field("invoices"); }, + + update_party_labels: function (frm) { + let is_sales = frm.doc.invoice_type == "Sales"; + + frm.fields_dict["invoices"].grid.update_docfield_property( + "party", + "label", + is_sales ? "Customer ID" : "Supplier ID" + ); + frm.fields_dict["invoices"].grid.update_docfield_property( + "party_name", + "label", + is_sales ? "Customer Name" : "Supplier Name" + ); + + frm.set_df_property( + "create_missing_party", + "description", + is_sales + ? __("If party does not exist, create it using the Customer Name field.") + : __("If party does not exist, create it using the Supplier Name field.") + ); + + frm.refresh_field("invoices"); + frm.refresh_field("create_missing_party"); + }, }); frappe.ui.form.on("Opening Invoice Creation Tool Item", { diff --git a/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.json b/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.json index 8d1c3e87ba1..535b7384b4d 100644 --- a/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.json +++ b/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.json @@ -7,10 +7,11 @@ "editable_grid": 1, "engine": "InnoDB", "field_order": [ + "section_break_ynel", "company", + "create_missing_party", "column_break_3", "invoice_type", - "create_missing_party", "accounting_dimensions_section", "cost_center", "dimension_col_break", @@ -25,11 +26,11 @@ "in_list_view": 1, "label": "Company", "options": "Company", + "remember_last_selected_value": 1, "reqd": 1 }, { "default": "0", - "description": "If party does not exist, create it using the Party Name field.", "fieldname": "create_missing_party", "fieldtype": "Check", "label": "Create Missing Party" @@ -79,12 +80,17 @@ { "fieldname": "dimension_col_break", "fieldtype": "Column Break" + }, + { + "fieldname": "section_break_ynel", + "fieldtype": "Section Break", + "hide_border": 1 } ], "hide_toolbar": 1, "issingle": 1, "links": [], - "modified": "2026-03-23 00:32:15.600086", + "modified": "2026-03-31 01:47:20.360352", "modified_by": "Administrator", "module": "Accounts", "name": "Opening Invoice Creation Tool",