Skip to content

Commit

Permalink
fix: show group warehouse in Sales Order (frappe#30891) (frappe#30893)
Browse files Browse the repository at this point in the history
(cherry picked from commit 91cd5f5)

Co-authored-by: Ankush Menat <ankush@frappe.io>
  • Loading branch information
mergify[bot] and ankush authored May 5, 2022
1 parent 5968609 commit c458e14
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions erpnext/selling/doctype/sales_order/sales_order.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ frappe.ui.form.on("Sales Order", {
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) {
Expand All @@ -77,7 +81,19 @@ frappe.ui.form.on("Sales Order", {
}
});

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'];
},
Expand Down

0 comments on commit c458e14

Please sign in to comment.