[report] migrated stock level report to script report and renamed to Stock Projected Qty
This commit is contained in:
parent
462401c4df
commit
690c75fa0d
@ -6,6 +6,8 @@ def execute():
|
||||
|
||||
webnotes.delete_doc('Page', 'stock-ledger')
|
||||
webnotes.delete_doc('Page', 'stock-ageing')
|
||||
webnotes.delete_doc('Page', 'stock-level')
|
||||
|
||||
os.system("rm -rf app/stock/page/stock_ledger")
|
||||
os.system("rm -rf app/stock/page/stock_ageing")
|
||||
os.system("rm -rf app/stock/page/stock_ageing")
|
||||
os.system("rm -rf app/stock/page/stock_level")
|
@ -138,7 +138,7 @@ wn.module_page["Stock"] = [
|
||||
items: [
|
||||
{
|
||||
"label":wn._("Stock Ledger"),
|
||||
doctype: "Delivery Note",
|
||||
doctype: "Item",
|
||||
route: "query-report/Stock Ledger"
|
||||
},
|
||||
{
|
||||
@ -146,8 +146,9 @@ wn.module_page["Stock"] = [
|
||||
page: "stock-balance"
|
||||
},
|
||||
{
|
||||
"page":"stock-level",
|
||||
"label": wn._("Stock Level")
|
||||
"label":wn._("Stock Projected Qty"),
|
||||
doctype: "Item",
|
||||
route: "query-report/Stock Projected Qty"
|
||||
},
|
||||
{
|
||||
"label":wn._("Stock Ageing"),
|
||||
|
0
stock/report/stock_projected_qty/__init__.py
Normal file
0
stock/report/stock_projected_qty/__init__.py
Normal file
33
stock/report/stock_projected_qty/stock_projected_qty.js
Normal file
33
stock/report/stock_projected_qty/stock_projected_qty.js
Normal file
@ -0,0 +1,33 @@
|
||||
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
wn.query_reports["Stock Projected Qty"] = {
|
||||
"filters": [
|
||||
{
|
||||
"fieldname":"company",
|
||||
"label": wn._("Company"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Company",
|
||||
"default": wn.defaults.get_user_default("company"),
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname":"warehouse",
|
||||
"label": wn._("Warehouse"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Warehouse"
|
||||
},
|
||||
{
|
||||
"fieldname":"item_code",
|
||||
"label": wn._("Item"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Item"
|
||||
},
|
||||
{
|
||||
"fieldname":"brand",
|
||||
"label": wn._("Brand"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Brand"
|
||||
}
|
||||
]
|
||||
}
|
54
stock/report/stock_projected_qty/stock_projected_qty.py
Normal file
54
stock/report/stock_projected_qty/stock_projected_qty.py
Normal file
@ -0,0 +1,54 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
from webnotes import _
|
||||
|
||||
def execute(filters=None):
|
||||
columns = get_columns()
|
||||
if not filters.get("company"):
|
||||
webnotes.throw(_("Company is mandatory"))
|
||||
|
||||
data = webnotes.conn.sql("""select
|
||||
item.name, item.item_name, description, brand, warehouse, item.stock_uom,
|
||||
actual_qty, planned_qty, indented_qty, ordered_qty, reserved_qty,
|
||||
projected_qty, item.re_order_level, item.re_order_qty
|
||||
from `tabBin` bin,
|
||||
(select name, company from tabWarehouse {warehouse_conditions}) wh,
|
||||
(select name, item_name, description, stock_uom, brand, re_order_level, re_order_qty
|
||||
from `tabItem` {item_conditions}) item
|
||||
where item_code = item.name and warehouse = wh.name
|
||||
order by item.name, wh.name"""\
|
||||
.format(item_conditions=get_item_conditions(filters),
|
||||
warehouse_conditions=get_warehouse_conditions(filters)), filters, debug=1)
|
||||
|
||||
return columns, data
|
||||
|
||||
def get_columns():
|
||||
return ["Item Code:Link/Item:140", "Item Name::100", "Description::200",
|
||||
"Brand:Link/Brand:100", "Warehouse:Link/Warehouse:120", "UOM:Link/UOM:100",
|
||||
"Actual Qty:Float:100", "Planned Qty:Float:100", "Requested Qty:Float:110",
|
||||
"Ordered Qty:Float:100", "Reserved Qty:Float:100", "Projected Qty:Float:100",
|
||||
"Reorder Level:Float:100", "Reorder Qty:Float:100"]
|
||||
|
||||
def get_item_conditions(filters):
|
||||
conditions = []
|
||||
if filters.get("item_code"):
|
||||
conditions.append("name=%(item_code)s")
|
||||
if filters.get("brand"):
|
||||
conditions.append("brand=%(brand)s")
|
||||
|
||||
return "where {}".format(" and ".join(conditions)) if conditions else ""
|
||||
|
||||
def get_warehouse_conditions(filters):
|
||||
conditions = []
|
||||
if not filters.get("company"):
|
||||
webnotes.throw(_("Company is mandatory"))
|
||||
else:
|
||||
conditions.append("company=%(company)s")
|
||||
|
||||
if filters.get("warehouse"):
|
||||
conditions.append("name=%(warehouse)s")
|
||||
|
||||
return "where {}".format(" and ".join(conditions)) if conditions else ""
|
22
stock/report/stock_projected_qty/stock_projected_qty.txt
Normal file
22
stock/report/stock_projected_qty/stock_projected_qty.txt
Normal file
@ -0,0 +1,22 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-12-04 18:21:56",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-12-04 18:21:56",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"add_total_row": 1,
|
||||
"doctype": "Report",
|
||||
"is_standard": "Yes",
|
||||
"name": "__common__",
|
||||
"ref_doctype": "Item",
|
||||
"report_name": "Stock Projected Qty",
|
||||
"report_type": "Script Report"
|
||||
},
|
||||
{
|
||||
"doctype": "Report",
|
||||
"name": "Stock Projected Qty"
|
||||
}
|
||||
]
|
Loading…
x
Reference in New Issue
Block a user