Skip to content

Commit fa5238b

Browse files
authored
fix(item_dashboard): escaping warehouse, item_code, stock_uom and item_name on get_data (#53904)
1 parent b9f26a1 commit fa5238b

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

erpnext/stock/dashboard/item_dashboard.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import frappe
22
from frappe.desk.reportview import build_match_conditions
3-
from frappe.utils import cint, flt
3+
from frappe.utils import cint, escape_html, flt
44

55
from erpnext.stock.doctype.stock_reservation_entry.stock_reservation_entry import (
66
get_sre_reserved_qty_for_items_and_warehouses as get_reserved_stock_details,
@@ -75,8 +75,10 @@ def get_data(
7575
for item in items:
7676
item.update(
7777
{
78-
"item_name": frappe.get_cached_value("Item", item.item_code, "item_name"),
79-
"stock_uom": frappe.get_cached_value("Item", item.item_code, "stock_uom"),
78+
"item_code": escape_html(item.item_code),
79+
"item_name": escape_html(frappe.get_cached_value("Item", item.item_code, "item_name")),
80+
"stock_uom": escape_html(frappe.get_cached_value("Item", item.item_code, "stock_uom")),
81+
"warehouse": escape_html(item.warehouse),
8082
"disable_quick_entry": frappe.get_cached_value("Item", item.item_code, "has_batch_no")
8183
or frappe.get_cached_value("Item", item.item_code, "has_serial_no"),
8284
"projected_qty": flt(item.projected_qty, precision),

erpnext/stock/dashboard/item_dashboard_list.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,15 @@
5050
data-warehouse="{{ d.warehouse }}"
5151
data-actual_qty="{{ d.actual_qty }}"
5252
data-stock-uom="{{ d.stock_uom }}"
53-
data-item="{{ escape(d.item_code) }}">{{ __("Move") }}</a>
53+
data-item="{{ d.item_code }}">{{ __("Move") }}</button>
5454
{% endif %}
5555
<button style="margin-left: 7px;" class="btn btn-default btn-xs btn-add"
5656
data-disable_quick_entry="{{ d.disable_quick_entry }}"
5757
data-warehouse="{{ d.warehouse }}"
5858
data-actual_qty="{{ d.actual_qty }}"
5959
data-stock-uom="{{ d.stock_uom }}"
60-
data-item="{{ escape(d.item_code) }}"
61-
data-rate="{{ d.valuation_rate }}">{{ __("Add") }}</a>
60+
data-item="{{ d.item_code }}"
61+
data-rate="{{ d.valuation_rate }}">{{ __("Add") }}</button>
6262
</div>
6363
{% endif %}
6464
</div>

0 commit comments

Comments
 (0)