mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-20 23:35:11 +00:00
fix: dynamic labels on invoice type change
(cherry picked from commit 820bd15e1e)
This commit is contained in:
@@ -70,9 +70,7 @@ frappe.ui.form.on("Opening Invoice Creation Tool", {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
if (frm.doc.create_missing_party) {
|
frm.trigger("update_party_labels");
|
||||||
frm.set_df_property("party", "fieldtype", "Data", frm.doc.name, "invoices");
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
setup_company_filters: function (frm) {
|
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", "");
|
||||||
frappe.model.set_value(row.doctype, row.name, "party_name", "");
|
frappe.model.set_value(row.doctype, row.name, "party_name", "");
|
||||||
});
|
});
|
||||||
|
frm.clear_table("invoices");
|
||||||
frm.refresh_fields();
|
frm.refresh_fields();
|
||||||
|
frm.trigger("update_party_labels");
|
||||||
},
|
},
|
||||||
|
|
||||||
make_dashboard: function (frm) {
|
make_dashboard: function (frm) {
|
||||||
@@ -175,6 +175,32 @@ frappe.ui.form.on("Opening Invoice Creation Tool", {
|
|||||||
}
|
}
|
||||||
frm.refresh_field("invoices");
|
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", {
|
frappe.ui.form.on("Opening Invoice Creation Tool Item", {
|
||||||
|
|||||||
@@ -7,10 +7,11 @@
|
|||||||
"editable_grid": 1,
|
"editable_grid": 1,
|
||||||
"engine": "InnoDB",
|
"engine": "InnoDB",
|
||||||
"field_order": [
|
"field_order": [
|
||||||
|
"section_break_ynel",
|
||||||
"company",
|
"company",
|
||||||
|
"create_missing_party",
|
||||||
"column_break_3",
|
"column_break_3",
|
||||||
"invoice_type",
|
"invoice_type",
|
||||||
"create_missing_party",
|
|
||||||
"accounting_dimensions_section",
|
"accounting_dimensions_section",
|
||||||
"cost_center",
|
"cost_center",
|
||||||
"dimension_col_break",
|
"dimension_col_break",
|
||||||
@@ -25,11 +26,11 @@
|
|||||||
"in_list_view": 1,
|
"in_list_view": 1,
|
||||||
"label": "Company",
|
"label": "Company",
|
||||||
"options": "Company",
|
"options": "Company",
|
||||||
|
"remember_last_selected_value": 1,
|
||||||
"reqd": 1
|
"reqd": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"default": "0",
|
"default": "0",
|
||||||
"description": "If party does not exist, create it using the Party Name field.",
|
|
||||||
"fieldname": "create_missing_party",
|
"fieldname": "create_missing_party",
|
||||||
"fieldtype": "Check",
|
"fieldtype": "Check",
|
||||||
"label": "Create Missing Party"
|
"label": "Create Missing Party"
|
||||||
@@ -79,12 +80,17 @@
|
|||||||
{
|
{
|
||||||
"fieldname": "dimension_col_break",
|
"fieldname": "dimension_col_break",
|
||||||
"fieldtype": "Column Break"
|
"fieldtype": "Column Break"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "section_break_ynel",
|
||||||
|
"fieldtype": "Section Break",
|
||||||
|
"hide_border": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"hide_toolbar": 1,
|
"hide_toolbar": 1,
|
||||||
"issingle": 1,
|
"issingle": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2026-03-23 00:32:15.600086",
|
"modified": "2026-03-31 01:47:20.360352",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Opening Invoice Creation Tool",
|
"name": "Opening Invoice Creation Tool",
|
||||||
|
|||||||
Reference in New Issue
Block a user