mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-27 08:54:45 +00:00
refactor: added new filters in the Batch-wise balance history report
This commit is contained in:
@@ -3,6 +3,14 @@
|
|||||||
|
|
||||||
frappe.query_reports["Batch-Wise Balance History"] = {
|
frappe.query_reports["Batch-Wise Balance History"] = {
|
||||||
"filters": [
|
"filters": [
|
||||||
|
{
|
||||||
|
"fieldname":"company",
|
||||||
|
"label": __("Company"),
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"options": "Company",
|
||||||
|
"default": frappe.defaults.get_user_default("Company"),
|
||||||
|
"reqd": 1
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"fieldname":"from_date",
|
"fieldname":"from_date",
|
||||||
"label": __("From Date"),
|
"label": __("From Date"),
|
||||||
@@ -18,6 +26,47 @@ frappe.query_reports["Batch-Wise Balance History"] = {
|
|||||||
"width": "80",
|
"width": "80",
|
||||||
"default": frappe.datetime.get_today(),
|
"default": frappe.datetime.get_today(),
|
||||||
"reqd": 1
|
"reqd": 1
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
"fieldname":"item_code",
|
||||||
|
"label": __("Item Code"),
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"options": "Item",
|
||||||
|
"get_query": function() {
|
||||||
|
return {
|
||||||
|
filters: {
|
||||||
|
"has_batch_no": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname":"warehouse",
|
||||||
|
"label": __("Warehouse"),
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"options": "Warehouse",
|
||||||
|
"get_query": function() {
|
||||||
|
let company = frappe.query_report.get_filter_value('company');
|
||||||
|
return {
|
||||||
|
filters: {
|
||||||
|
"company": company
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname":"batch_no",
|
||||||
|
"label": __("Batch No"),
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"options": "Batch",
|
||||||
|
"get_query": function() {
|
||||||
|
let item_code = frappe.query_report.get_filter_value('item_code');
|
||||||
|
return {
|
||||||
|
filters: {
|
||||||
|
"item": item_code
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -53,6 +53,10 @@ def get_conditions(filters):
|
|||||||
else:
|
else:
|
||||||
frappe.throw(_("'To Date' is required"))
|
frappe.throw(_("'To Date' is required"))
|
||||||
|
|
||||||
|
for field in ["item_code", "warehouse", "batch_no", "company"]:
|
||||||
|
if filters.get(field):
|
||||||
|
conditions += " and {0} = {1}".format(field, frappe.db.escape(filters.get(field)))
|
||||||
|
|
||||||
return conditions
|
return conditions
|
||||||
|
|
||||||
#get all details
|
#get all details
|
||||||
|
|||||||
Reference in New Issue
Block a user