fix: swap warehouse labels for return entry

(cherry picked from commit f0c3f0d0be)
This commit is contained in:
Kavin
2025-10-14 13:14:39 +05:30
committed by Mergify
parent b82f8648f1
commit c5dc810642

View File

@@ -109,6 +109,7 @@ erpnext.sales_common = {
);
this.toggle_editable_price_list_rate();
this.change_warehouse_labels_for_return();
}
company() {
@@ -500,6 +501,33 @@ erpnext.sales_common = {
this.frm.set_value("discount_amount", 0);
this.frm.set_value("additional_discount_percentage", 0);
}
is_return() {
let reset = !this.frm.doc.is_return;
this.change_warehouse_labels_for_return(reset);
}
change_warehouse_labels_for_return(reset) {
// swap source and target warehouse labels for return
let source_warehouse_label = __("Source Warehouse");
let target_warehouse_label = __("Set Target Warehouse");
if (this.frm.doc.doctype == "Delivery Note") {
source_warehouse_label = __("Set Source Warehouse");
}
if (reset) {
// reset to original labels
this.frm.set_df_property("set_warehouse", "label", source_warehouse_label);
this.frm.set_df_property("set_target_warehouse", "label", target_warehouse_label);
return;
}
if (this.frm.doc.is_return) {
this.frm.set_df_property("set_warehouse", "label", target_warehouse_label);
this.frm.set_df_property("set_target_warehouse", "label", source_warehouse_label);
}
}
};
},
};