fix: total stock summary UI glitch #28564
fix: total stock summary UI glitch
This commit is contained in:
parent
8b33358660
commit
87f2dcfb59
@ -10,23 +10,8 @@ frappe.query_reports["Total Stock Summary"] = {
|
||||
"fieldtype": "Select",
|
||||
"width": "80",
|
||||
"reqd": 1,
|
||||
"options": ["", "Warehouse", "Company"],
|
||||
"change": function() {
|
||||
let group_by = frappe.query_report.get_filter_value("group_by")
|
||||
let company_filter = frappe.query_report.get_filter("company")
|
||||
if (group_by == "Company") {
|
||||
company_filter.df.reqd = 0;
|
||||
company_filter.df.hidden = 1;
|
||||
frappe.query_report.set_filter_value("company", "");
|
||||
company_filter.refresh();
|
||||
}
|
||||
else {
|
||||
company_filter.df.reqd = 1;
|
||||
company_filter.df.hidden = 0;
|
||||
company_filter.refresh();
|
||||
frappe.query_report.refresh();
|
||||
}
|
||||
}
|
||||
"options": ["Warehouse", "Company"],
|
||||
"default": "Warehouse",
|
||||
},
|
||||
{
|
||||
"fieldname": "company",
|
||||
@ -34,8 +19,9 @@ frappe.query_reports["Total Stock Summary"] = {
|
||||
"fieldtype": "Link",
|
||||
"width": "80",
|
||||
"options": "Company",
|
||||
"reqd": 1,
|
||||
"default": frappe.defaults.get_user_default("Company"),
|
||||
"reqd": 1
|
||||
"depends_on": "eval: doc.group_by != 'Company'",
|
||||
},
|
||||
]
|
||||
}
|
||||
|
@ -7,8 +7,9 @@ from frappe import _
|
||||
|
||||
|
||||
def execute(filters=None):
|
||||
if not filters: filters = {}
|
||||
validate_filters(filters)
|
||||
|
||||
if not filters:
|
||||
filters = {}
|
||||
columns = get_columns()
|
||||
stock = get_total_stock(filters)
|
||||
|
||||
@ -53,9 +54,3 @@ def get_total_stock(filters):
|
||||
ON warehouse.name = ledger.warehouse
|
||||
WHERE
|
||||
ledger.actual_qty != 0 %s""" % (columns, conditions))
|
||||
|
||||
def validate_filters(filters):
|
||||
if filters.get("group_by") == 'Company' and \
|
||||
filters.get("company"):
|
||||
|
||||
frappe.throw(_("Please set Company filter blank if Group By is 'Company'"))
|
||||
|
Loading…
x
Reference in New Issue
Block a user