fix: show group warehouse in Sales Order (#30891)
diff --git a/erpnext/selling/doctype/sales_order/sales_order.js b/erpnext/selling/doctype/sales_order/sales_order.js
index 26c9996..6b6ea89 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.js
+++ b/erpnext/selling/doctype/sales_order/sales_order.js
@@ -65,7 +65,11 @@
frm.set_value('transaction_date', frappe.datetime.get_today())
}
erpnext.queries.setup_queries(frm, "Warehouse", function() {
- return erpnext.queries.warehouse(frm.doc);
+ return {
+ filters: [
+ ["Warehouse", "company", "in", ["", cstr(frm.doc.company)]],
+ ]
+ };
});
frm.set_query('project', function(doc, cdt, cdn) {
@@ -77,7 +81,19 @@
}
});
- erpnext.queries.setup_warehouse_query(frm);
+ frm.set_query('warehouse', 'items', function(doc, cdt, cdn) {
+ let row = locals[cdt][cdn];
+ let query = {
+ filters: [
+ ["Warehouse", "company", "in", ["", cstr(frm.doc.company)]],
+ ]
+ };
+ if (row.item_code) {
+ query.query = "erpnext.controllers.queries.warehouse_query";
+ query.filters.push(["Bin", "item_code", "=", row.item_code]);
+ }
+ return query;
+ });
frm.ignore_doctypes_on_cancel_all = ['Purchase Order'];
},