mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-02 03:39:11 +00:00
Stock balance grid report deprecated and moved to server side
This commit is contained in:
@@ -82,3 +82,4 @@ erpnext.patches.v4_2.set_company_country
|
|||||||
erpnext.patches.v4_2.update_sales_order_invoice_field_name
|
erpnext.patches.v4_2.update_sales_order_invoice_field_name
|
||||||
erpnext.patches.v4_2.cost_of_production_cycle
|
erpnext.patches.v4_2.cost_of_production_cycle
|
||||||
erpnext.patches.v4_2.seprate_manufacture_and_repack
|
erpnext.patches.v4_2.seprate_manufacture_and_repack
|
||||||
|
execute:frappe.delete_doc("Report", "Warehouse-Wise Stock Balance")
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors and contributors
|
||||||
// License: GNU General Public License v3. See license.txt
|
// For license information, please see license.txt
|
||||||
|
|
||||||
frappe.query_reports["Warehouse-Wise Stock Balance"] = {
|
frappe.query_reports["Stock Balance"] = {
|
||||||
"filters": [
|
"filters": [
|
||||||
{
|
{
|
||||||
"fieldname":"from_date",
|
"fieldname":"from_date",
|
||||||
@@ -1,16 +1,17 @@
|
|||||||
{
|
{
|
||||||
|
"add_total_row": 0,
|
||||||
"apply_user_permissions": 1,
|
"apply_user_permissions": 1,
|
||||||
"creation": "2013-06-05 11:00:31",
|
"creation": "2014-10-10 17:58:11.577901",
|
||||||
|
"disabled": 0,
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"doctype": "Report",
|
"doctype": "Report",
|
||||||
"idx": 1,
|
|
||||||
"is_standard": "Yes",
|
"is_standard": "Yes",
|
||||||
"modified": "2014-06-03 07:18:17.384923",
|
"modified": "2014-10-10 17:58:11.577901",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Stock",
|
"module": "Stock",
|
||||||
"name": "Warehouse-Wise Stock Balance",
|
"name": "Stock Balance",
|
||||||
"owner": "Administrator",
|
"owner": "Administrator",
|
||||||
"ref_doctype": "Stock Ledger Entry",
|
"ref_doctype": "Stock Ledger Entry",
|
||||||
"report_name": "Warehouse-Wise Stock Balance",
|
"report_name": "Stock Balance",
|
||||||
"report_type": "Script Report"
|
"report_type": "Script Report"
|
||||||
}
|
}
|
||||||
@@ -59,9 +59,9 @@ def get_conditions(filters):
|
|||||||
def get_stock_ledger_entries(filters):
|
def get_stock_ledger_entries(filters):
|
||||||
conditions = get_conditions(filters)
|
conditions = get_conditions(filters)
|
||||||
return frappe.db.sql("""select item_code, warehouse, posting_date,
|
return frappe.db.sql("""select item_code, warehouse, posting_date,
|
||||||
actual_qty, valuation_rate, stock_uom, company
|
actual_qty, valuation_rate, stock_uom, company, voucher_type, qty_after_transaction
|
||||||
from `tabStock Ledger Entry`
|
from `tabStock Ledger Entry`
|
||||||
where docstatus < 2 %s order by item_code, warehouse""" %
|
where docstatus < 2 %s order by posting_date, posting_time, name""" %
|
||||||
conditions, as_dict=1)
|
conditions, as_dict=1)
|
||||||
|
|
||||||
def get_item_warehouse_map(filters):
|
def get_item_warehouse_map(filters):
|
||||||
@@ -80,21 +80,27 @@ def get_item_warehouse_map(filters):
|
|||||||
qty_dict = iwb_map[d.company][d.item_code][d.warehouse]
|
qty_dict = iwb_map[d.company][d.item_code][d.warehouse]
|
||||||
qty_dict.uom = d.stock_uom
|
qty_dict.uom = d.stock_uom
|
||||||
|
|
||||||
|
if d.voucher_type == "Stock Reconciliation":
|
||||||
|
qty_diff = flt(d.qty_after_transaction) - qty_dict.bal_qty
|
||||||
|
value_diff = flt(d.stock_value) - qty_dict.bal_val
|
||||||
|
else:
|
||||||
|
qty_diff = flt(d.actual_qty)
|
||||||
|
value_diff = flt(d.actual_qty) * flt(d.valuation_rate)
|
||||||
|
|
||||||
if d.posting_date < filters["from_date"]:
|
if d.posting_date < filters["from_date"]:
|
||||||
qty_dict.opening_qty += flt(d.actual_qty)
|
qty_dict.opening_qty += qty_diff
|
||||||
qty_dict.opening_val += flt(d.actual_qty) * flt(d.valuation_rate)
|
qty_dict.opening_val += value_diff
|
||||||
elif d.posting_date >= filters["from_date"] and d.posting_date <= filters["to_date"]:
|
elif d.posting_date >= filters["from_date"] and d.posting_date <= filters["to_date"]:
|
||||||
qty_dict.val_rate = d.valuation_rate
|
qty_dict.val_rate = d.valuation_rate
|
||||||
|
if qty_diff > 0:
|
||||||
if flt(d.actual_qty) > 0:
|
qty_dict.in_qty += qty_diff
|
||||||
qty_dict.in_qty += flt(d.actual_qty)
|
qty_dict.in_val += value_diff
|
||||||
qty_dict.in_val += flt(d.actual_qty) * flt(d.valuation_rate)
|
|
||||||
else:
|
else:
|
||||||
qty_dict.out_qty += abs(flt(d.actual_qty))
|
qty_dict.out_qty += abs(qty_diff)
|
||||||
qty_dict.out_val += flt(abs(flt(d.actual_qty) * flt(d.valuation_rate)))
|
qty_dict.out_val += abs(value_diff)
|
||||||
|
|
||||||
qty_dict.bal_qty += flt(d.actual_qty)
|
qty_dict.bal_qty += qty_diff
|
||||||
qty_dict.bal_val += flt(d.actual_qty) * flt(d.valuation_rate)
|
qty_dict.bal_val += value_diff
|
||||||
|
|
||||||
return iwb_map
|
return iwb_map
|
||||||
|
|
||||||
Reference in New Issue
Block a user