fix: label for warehouse based on material request type

This commit is contained in:
Rohit Waghchaure
2025-12-01 18:48:53 +05:30
parent 8ed9ee9213
commit 699e9b4452

View File

@@ -105,6 +105,7 @@ frappe.ui.form.on("Material Request", {
frm.events.make_custom_buttons(frm); frm.events.make_custom_buttons(frm);
frm.toggle_reqd("customer", frm.doc.material_request_type == "Customer Provided"); frm.toggle_reqd("customer", frm.doc.material_request_type == "Customer Provided");
prevent_past_schedule_dates(frm); prevent_past_schedule_dates(frm);
frm.trigger("set_warehouse_label");
}, },
transaction_date(frm) { transaction_date(frm) {
@@ -514,6 +515,23 @@ frappe.ui.form.on("Material Request", {
if (frm.doc.material_request_type !== "Material Transfer" && frm.doc.set_from_warehouse) { if (frm.doc.material_request_type !== "Material Transfer" && frm.doc.set_from_warehouse) {
frm.set_value("set_from_warehouse", ""); frm.set_value("set_from_warehouse", "");
} }
frm.trigger("set_warehouse_label");
},
set_warehouse_label(frm) {
let warehouse_label =
frm.doc.material_request_type === "Material Transfer" ? "Target Warehouse" : "Warehouse";
if (frm.doc.material_request_type === "Material Issue") {
warehouse_label = "From Warehouse";
}
frm.fields_dict["items"].grid.update_docfield_property("warehouse", "label", __(warehouse_label));
warehouse_label = "Set " + warehouse_label;
frm.set_df_property("set_warehouse", "label", __(warehouse_label));
refresh_field("items");
}, },
}); });