Skip to content

Commit

Permalink
fix: stock ledger variance report filter options (backport #44137) (#…
Browse files Browse the repository at this point in the history
…44150)

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

(cherry picked from commit e8bbf64)

Co-authored-by: rohitwaghchaure <[email protected]>
  • Loading branch information
mergify[bot] and rohitwaghchaure authored Nov 15, 2024
1 parent 5b3f082 commit b6fe1f5
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 7 deletions.
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

0 comments on commit b6fe1f5

Please sign in to comment.