fix(ux): apply proper filtering in stock reports (#27411) (#27443)

* 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>
(cherry picked from commit d743c41b54)

Co-authored-by: Ankush Menat <ankush@iwebnotes.com>
This commit is contained in:
Frappe PR Bot
2021-09-12 16:41:17 +05:30
committed by GitHub
parent dd352df168
commit 74fa6fab4c
2 changed files with 17 additions and 8 deletions

View File

@@ -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",

View File

@@ -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}
}
}
}
},