mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-13 02:01:21 +00:00
fix: total stock summary UI glitch #28564
fix: total stock summary UI glitch
This commit is contained in:
@@ -10,23 +10,8 @@ frappe.query_reports["Total Stock Summary"] = {
|
|||||||
"fieldtype": "Select",
|
"fieldtype": "Select",
|
||||||
"width": "80",
|
"width": "80",
|
||||||
"reqd": 1,
|
"reqd": 1,
|
||||||
"options": ["", "Warehouse", "Company"],
|
"options": ["Warehouse", "Company"],
|
||||||
"change": function() {
|
"default": "Warehouse",
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "company",
|
"fieldname": "company",
|
||||||
@@ -34,8 +19,9 @@ frappe.query_reports["Total Stock Summary"] = {
|
|||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"width": "80",
|
"width": "80",
|
||||||
"options": "Company",
|
"options": "Company",
|
||||||
|
"reqd": 1,
|
||||||
"default": frappe.defaults.get_user_default("Company"),
|
"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):
|
def execute(filters=None):
|
||||||
if not filters: filters = {}
|
|
||||||
validate_filters(filters)
|
if not filters:
|
||||||
|
filters = {}
|
||||||
columns = get_columns()
|
columns = get_columns()
|
||||||
stock = get_total_stock(filters)
|
stock = get_total_stock(filters)
|
||||||
|
|
||||||
@@ -53,9 +54,3 @@ def get_total_stock(filters):
|
|||||||
ON warehouse.name = ledger.warehouse
|
ON warehouse.name = ledger.warehouse
|
||||||
WHERE
|
WHERE
|
||||||
ledger.actual_qty != 0 %s""" % (columns, conditions))
|
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'"))
|
|
||||||
|
|||||||
Reference in New Issue
Block a user