fix: update set query for warehouse after changing the company (#22632)
* fix: update set query for warehouse after changing the company
* fix: changed set_query to get_query
* fix: variable filter doesn't get updated once set on load hence removed
Co-authored-by: Marica <maricadsouza221197@gmail.com>
diff --git a/erpnext/stock/doctype/material_request/material_request.js b/erpnext/stock/doctype/material_request/material_request.js
index 60f5ff3..3c4e353 100644
--- a/erpnext/stock/doctype/material_request/material_request.js
+++ b/erpnext/stock/doctype/material_request/material_request.js
@@ -49,17 +49,21 @@
// set schedule_date
set_schedule_date(frm);
- let filters = {'company': frm.doc.company}
-
- frm.set_query("warehouse", "items", function() {
+ frm.set_query("warehouse", "items", function(doc) {
return {
- filters: filters
+ filters: {'company': doc.company}
};
});
- frm.set_query("set_warehouse", function(){
+ frm.set_query("set_warehouse", function(doc){
return {
- filters: filters
+ filters: {'company': doc.company}
+ };
+ });
+
+ frm.set_query("set_from_warehouse", function(doc){
+ return {
+ filters: {'company': doc.company}
};
});
},