chore: Added company filter and minor cleanup in Stock Balance Report
This commit is contained in:
parent
a8779872ee
commit
89c41d8384
@ -19,6 +19,14 @@ frappe.query_reports["Stock Balance"] = {
|
|||||||
"reqd": 1,
|
"reqd": 1,
|
||||||
"default": frappe.datetime.get_today()
|
"default": frappe.datetime.get_today()
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "company",
|
||||||
|
"label": __("Company"),
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"width": "80",
|
||||||
|
"options": "Company",
|
||||||
|
"default": frappe.defaults.get_default("company")
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "item_group",
|
"fieldname": "item_group",
|
||||||
"label": __("Item Group"),
|
"label": __("Item Group"),
|
||||||
@ -26,12 +34,6 @@ frappe.query_reports["Stock Balance"] = {
|
|||||||
"width": "80",
|
"width": "80",
|
||||||
"options": "Item Group"
|
"options": "Item Group"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"fieldname":"brand",
|
|
||||||
"label": __("Brand"),
|
|
||||||
"fieldtype": "Link",
|
|
||||||
"options": "Brand"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"fieldname": "item_code",
|
"fieldname": "item_code",
|
||||||
"label": __("Item"),
|
"label": __("Item"),
|
||||||
@ -84,5 +86,18 @@ frappe.query_reports["Stock Balance"] = {
|
|||||||
"label": __('Show Stock Ageing Data'),
|
"label": __('Show Stock Ageing Data'),
|
||||||
"fieldtype": 'Check'
|
"fieldtype": 'Check'
|
||||||
},
|
},
|
||||||
]
|
],
|
||||||
|
|
||||||
|
"formatter": function (value, row, column, data, default_formatter) {
|
||||||
|
value = default_formatter(value, row, column, data);
|
||||||
|
|
||||||
|
if (column.fieldname == "out_qty" && data && data.out_qty > 0) {
|
||||||
|
value = "<span style='color:red'>" + value + "</span>";
|
||||||
|
}
|
||||||
|
else if (column.fieldname == "in_qty" && data && data.in_qty > 0) {
|
||||||
|
value = "<span style='color:green'>" + value + "</span>";
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,24 +1,26 @@
|
|||||||
{
|
{
|
||||||
"add_total_row": 1,
|
"add_total_row": 1,
|
||||||
"creation": "2014-10-10 17:58:11.577901",
|
"creation": "2014-10-10 17:58:11.577901",
|
||||||
"disabled": 0,
|
"disable_prepared_report": 0,
|
||||||
"docstatus": 0,
|
"disabled": 0,
|
||||||
"doctype": "Report",
|
"docstatus": 0,
|
||||||
"idx": 2,
|
"doctype": "Report",
|
||||||
"is_standard": "Yes",
|
"idx": 2,
|
||||||
"modified": "2018-08-14 15:24:41.395557",
|
"is_standard": "Yes",
|
||||||
"modified_by": "Administrator",
|
"modified": "2020-04-30 13:46:14.680354",
|
||||||
"module": "Stock",
|
"modified_by": "Administrator",
|
||||||
"name": "Stock Balance",
|
"module": "Stock",
|
||||||
"owner": "Administrator",
|
"name": "Stock Balance",
|
||||||
"prepared_report": 1,
|
"owner": "Administrator",
|
||||||
"ref_doctype": "Stock Ledger Entry",
|
"prepared_report": 1,
|
||||||
"report_name": "Stock Balance",
|
"query": "",
|
||||||
"report_type": "Script Report",
|
"ref_doctype": "Stock Ledger Entry",
|
||||||
|
"report_name": "Stock Balance",
|
||||||
|
"report_type": "Script Report",
|
||||||
"roles": [
|
"roles": [
|
||||||
{
|
{
|
||||||
"role": "Stock User"
|
"role": "Stock User"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"role": "Accounts Manager"
|
"role": "Accounts Manager"
|
||||||
}
|
}
|
||||||
|
@ -94,8 +94,6 @@ def get_columns(filters):
|
|||||||
{"label": _("Item"), "fieldname": "item_code", "fieldtype": "Link", "options": "Item", "width": 100},
|
{"label": _("Item"), "fieldname": "item_code", "fieldtype": "Link", "options": "Item", "width": 100},
|
||||||
{"label": _("Item Name"), "fieldname": "item_name", "width": 150},
|
{"label": _("Item Name"), "fieldname": "item_name", "width": 150},
|
||||||
{"label": _("Item Group"), "fieldname": "item_group", "fieldtype": "Link", "options": "Item Group", "width": 100},
|
{"label": _("Item Group"), "fieldname": "item_group", "fieldtype": "Link", "options": "Item Group", "width": 100},
|
||||||
{"label": _("Brand"), "fieldname": "brand", "fieldtype": "Link", "options": "Brand", "width": 90},
|
|
||||||
{"label": _("Description"), "fieldname": "description", "width": 140},
|
|
||||||
{"label": _("Warehouse"), "fieldname": "warehouse", "fieldtype": "Link", "options": "Warehouse", "width": 100},
|
{"label": _("Warehouse"), "fieldname": "warehouse", "fieldtype": "Link", "options": "Warehouse", "width": 100},
|
||||||
{"label": _("Stock UOM"), "fieldname": "stock_uom", "fieldtype": "Link", "options": "UOM", "width": 90},
|
{"label": _("Stock UOM"), "fieldname": "stock_uom", "fieldtype": "Link", "options": "UOM", "width": 90},
|
||||||
{"label": _("Balance Qty"), "fieldname": "bal_qty", "fieldtype": "Float", "width": 100, "convertible": "qty"},
|
{"label": _("Balance Qty"), "fieldname": "bal_qty", "fieldtype": "Float", "width": 100, "convertible": "qty"},
|
||||||
@ -132,6 +130,9 @@ def get_conditions(filters):
|
|||||||
else:
|
else:
|
||||||
frappe.throw(_("'To Date' is required"))
|
frappe.throw(_("'To Date' is required"))
|
||||||
|
|
||||||
|
if filters.get("company"):
|
||||||
|
conditions += " and sle.company = %s" % frappe.db.escape(filters.get("company"))
|
||||||
|
|
||||||
if filters.get("warehouse"):
|
if filters.get("warehouse"):
|
||||||
warehouse_details = frappe.db.get_value("Warehouse",
|
warehouse_details = frappe.db.get_value("Warehouse",
|
||||||
filters.get("warehouse"), ["lft", "rgt"], as_dict=1)
|
filters.get("warehouse"), ["lft", "rgt"], as_dict=1)
|
||||||
@ -233,8 +234,6 @@ def get_items(filters):
|
|||||||
if filters.get("item_code"):
|
if filters.get("item_code"):
|
||||||
conditions.append("item.name=%(item_code)s")
|
conditions.append("item.name=%(item_code)s")
|
||||||
else:
|
else:
|
||||||
if filters.get("brand"):
|
|
||||||
conditions.append("item.brand=%(brand)s")
|
|
||||||
if filters.get("item_group"):
|
if filters.get("item_group"):
|
||||||
conditions.append(get_item_group_condition(filters.get("item_group")))
|
conditions.append(get_item_group_condition(filters.get("item_group")))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user