Skip to content

Commit

Permalink
fix(ux): apply proper filtering in stock reports (frappe#27411)
Browse files Browse the repository at this point in the history
* fix(ux): apply proper filtering in stock reports

Stock Balance: apply company filter to warehouse field
Stock Ageing: apply company filter to warehouse field

* fix: unnecessary parens

Co-authored-by: Alan <2.alan.tom@gmail.com>
  • Loading branch information
ankush and 18alantom committed Sep 12, 2021
1 parent 6ef879f commit d743c41
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
10 changes: 9 additions & 1 deletion erpnext/stock/report/stock_ageing/stock_ageing.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,15 @@ frappe.query_reports["Stock Ageing"] = {
"fieldname":"warehouse",
"label": __("Warehouse"),
"fieldtype": "Link",
"options": "Warehouse"
"options": "Warehouse",
get_query: () => {
const company = frappe.query_report.get_filter_value("company");
return {
filters: {
...company && {company},
}
};
}
},
{
"fieldname":"item_code",
Expand Down
15 changes: 8 additions & 7 deletions erpnext/stock/report/stock_balance/stock_balance.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,14 @@ frappe.query_reports["Stock Balance"] = {
"width": "80",
"options": "Warehouse",
get_query: () => {
var warehouse_type = frappe.query_report.get_filter_value('warehouse_type');
if(warehouse_type){
return {
filters: {
'warehouse_type': warehouse_type
}
};
let warehouse_type = frappe.query_report.get_filter_value("warehouse_type");
let company = frappe.query_report.get_filter_value("company");

return {
filters: {
...warehouse_type && {warehouse_type},
...company && {company}
}
}
}
},
Expand Down

0 comments on commit d743c41

Please sign in to comment.