Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: stock ledger variance report filter options (backport #44137) #44150

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,23 @@ frappe.query_reports["Stock Ledger Variance"] = {
fieldname: "difference_in",
fieldtype: "Select",
label: __("Difference In"),
options: ["", "Qty", "Value", "Valuation"],
options: [
{
// Check "Stock Ledger Invariant Check" report with A - B column
label: __("Quantity (A - B)"),
value: "Qty",
},
{
// Check "Stock Ledger Invariant Check" report with G - D column
label: __("Value (G - D)"),
value: "Value",
},
{
// Check "Stock Ledger Invariant Check" report with I - K column
label: __("Valuation (I - K)"),
value: "Valuation",
},
],
},
{
fieldname: "include_disabled",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt

import json

import frappe
from frappe import _
from frappe.utils import cint, flt
Expand Down Expand Up @@ -270,12 +272,16 @@ def has_difference(row, precision, difference_in, valuation_method):
value_diff = flt(row.diff_value_diff, precision)
valuation_diff = flt(row.valuation_diff, precision)
else:
qty_diff = flt(row.difference_in_qty, precision) or flt(row.fifo_qty_diff, precision)
value_diff = (
flt(row.diff_value_diff, precision)
or flt(row.fifo_value_diff, precision)
or flt(row.fifo_difference_diff, precision)
)
qty_diff = flt(row.difference_in_qty, precision)
value_diff = flt(row.diff_value_diff, precision)

if row.stock_queue and json.loads(row.stock_queue):
value_diff = value_diff or (
flt(row.fifo_value_diff, precision) or flt(row.fifo_difference_diff, precision)
)

qty_diff = qty_diff or flt(row.fifo_qty_diff, precision)

valuation_diff = flt(row.valuation_diff, precision) or flt(row.fifo_valuation_diff, precision)

if difference_in == "Qty" and qty_diff:
Expand Down
Loading