2015-03-03 09:25:30 +00:00
|
|
|
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors and contributors
|
2014-10-10 12:32:23 +00:00
|
|
|
// For license information, please see license.txt
|
2013-08-05 09:29:54 +00:00
|
|
|
|
2014-10-10 12:32:23 +00:00
|
|
|
frappe.query_reports["Stock Balance"] = {
|
2013-06-05 06:06:24 +00:00
|
|
|
"filters": [
|
|
|
|
{
|
|
|
|
"fieldname":"from_date",
|
2014-04-14 10:55:30 +00:00
|
|
|
"label": __("From Date"),
|
2013-06-05 06:06:24 +00:00
|
|
|
"fieldtype": "Date",
|
|
|
|
"width": "80",
|
|
|
|
"default": sys_defaults.year_start_date,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"fieldname":"to_date",
|
2014-04-14 10:55:30 +00:00
|
|
|
"label": __("To Date"),
|
2013-06-05 06:06:24 +00:00
|
|
|
"fieldtype": "Date",
|
|
|
|
"width": "80",
|
2014-02-14 10:17:51 +00:00
|
|
|
"default": frappe.datetime.get_today()
|
2015-02-18 14:21:48 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"fieldname": "item_code",
|
|
|
|
"label": __("Item"),
|
|
|
|
"fieldtype": "Link",
|
|
|
|
"width": "80",
|
2016-03-07 07:41:59 +00:00
|
|
|
"options": "Item",
|
|
|
|
"reqd": 1,
|
|
|
|
"on_change": function(me) {
|
|
|
|
frappe.query_reports["Stock Balance"].toggle_mandatory_filters(me);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"fieldname": "warehouse",
|
|
|
|
"label": __("Warehouse"),
|
|
|
|
"fieldtype": "Link",
|
|
|
|
"width": "80",
|
|
|
|
"options": "Warehouse",
|
|
|
|
"reqd": 1,
|
|
|
|
"on_change": function(me) {
|
|
|
|
frappe.query_reports["Stock Balance"].toggle_mandatory_filters(me);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
],
|
|
|
|
|
|
|
|
"toggle_mandatory_filters": function(me) {
|
|
|
|
var values = me.get_values(false);
|
|
|
|
var item_filter = me.filters_by_name["item_code"];
|
|
|
|
var warehouse_filter = me.filters_by_name["warehouse"];
|
|
|
|
|
|
|
|
if (values.item_code) {
|
|
|
|
warehouse_filter.df.reqd = 0;
|
|
|
|
} else if (values.warehouse) {
|
|
|
|
item_filter.df.reqd = 0;
|
|
|
|
} else {
|
|
|
|
item_filter.df.reqd = 1;
|
|
|
|
warehouse_filter.df.reqd = 1;
|
2013-06-05 06:06:24 +00:00
|
|
|
}
|
2016-03-07 07:41:59 +00:00
|
|
|
|
|
|
|
item_filter.set_mandatory(values.item_code);
|
|
|
|
warehouse_filter.set_mandatory(values.warehouse);
|
|
|
|
}
|
2014-10-10 12:32:23 +00:00
|
|
|
}
|