Skip to content

Commit 6219d7d

Browse files
rohitwaghchauremergify[bot]
authored andcommitted
fix: Show non-SLE vouchers with GL entries in Stock vs Account Value Comparison report
(cherry picked from commit 1db9ce2) # Conflicts: # erpnext/stock/report/stock_and_account_value_comparison/stock_and_account_value_comparison.py
1 parent eb02493 commit 6219d7d

1 file changed

Lines changed: 43 additions & 2 deletions

File tree

erpnext/stock/report/stock_and_account_value_comparison/stock_and_account_value_comparison.py

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,37 @@ def get_data(report_filters):
4242
gl_data = voucher_wise_gl_data.get(key) or {}
4343
d.account_value = gl_data.get("account_value", 0)
4444
d.difference_value = d.stock_value - d.account_value
45+
d.ledger_type = "Stock Ledger Entry"
4546
if abs(d.difference_value) > 0.1:
4647
data.append(d)
4748

49+
if key in voucher_wise_gl_data:
50+
del voucher_wise_gl_data[key]
51+
52+
if voucher_wise_gl_data:
53+
data += get_gl_ledgers_with_no_stock_ledger_entries(voucher_wise_gl_data)
54+
55+
return data
56+
57+
58+
def get_gl_ledgers_with_no_stock_ledger_entries(voucher_wise_gl_data):
59+
data = []
60+
61+
for key in voucher_wise_gl_data:
62+
gl_data = voucher_wise_gl_data.get(key) or {}
63+
data.append(
64+
{
65+
"name": gl_data.get("name"),
66+
"ledger_type": "GL Entry",
67+
"voucher_type": gl_data.get("voucher_type"),
68+
"voucher_no": gl_data.get("voucher_no"),
69+
"posting_date": gl_data.get("posting_date"),
70+
"stock_value": 0,
71+
"account_value": gl_data.get("account_value", 0),
72+
"difference_value": gl_data.get("account_value", 0) * -1,
73+
}
74+
)
75+
4876
return data
4977

5078

@@ -88,7 +116,15 @@ def get_gl_data(report_filters, filters):
88116
"name",
89117
"voucher_type",
90118
"voucher_no",
119+
<<<<<<< HEAD
91120
"sum(debit_in_account_currency) - sum(credit_in_account_currency) as account_value",
121+
=======
122+
"posting_date",
123+
{
124+
"SUB": [{"SUM": "debit_in_account_currency"}, {"SUM": "credit_in_account_currency"}],
125+
"as": "account_value",
126+
},
127+
>>>>>>> 1db9ce205f (fix: Show non-SLE vouchers with GL entries in Stock vs Account Value Comparison report)
92128
],
93129
group_by="voucher_type, voucher_no",
94130
)
@@ -106,10 +142,15 @@ def get_columns(filters):
106142
{
107143
"label": _("Stock Ledger ID"),
108144
"fieldname": "name",
109-
"fieldtype": "Link",
110-
"options": "Stock Ledger Entry",
145+
"fieldtype": "Dynamic Link",
146+
"options": "ledger_type",
111147
"width": "80",
112148
},
149+
{
150+
"label": _("Ledger Type"),
151+
"fieldname": "ledger_type",
152+
"fieldtype": "Data",
153+
},
113154
{"label": _("Posting Date"), "fieldname": "posting_date", "fieldtype": "Date"},
114155
{"label": _("Posting Time"), "fieldname": "posting_time", "fieldtype": "Time"},
115156
{"label": _("Voucher Type"), "fieldname": "voucher_type", "width": "110"},

0 commit comments

Comments
 (0)