fix(pos): broken image in item details section
diff --git a/erpnext/selling/page/point_of_sale/pos_item_details.js b/erpnext/selling/page/point_of_sale/pos_item_details.js
index df62696..5e09df8 100644
--- a/erpnext/selling/page/point_of_sale/pos_item_details.js
+++ b/erpnext/selling/page/point_of_sale/pos_item_details.js
@@ -133,13 +133,24 @@
this.$item_description.html(get_description_html());
this.$item_price.html(format_currency(price_list_rate, this.currency));
if (image) {
- this.$item_image.html(`<img src="${image}" alt="${image}">`);
+ this.$item_image.html(
+ `<img
+ onerror="cur_pos.item_details.handle_broken_image(this)"
+ class="h-full" src="${image}"
+ alt="${frappe.get_abbr(item_name)}"
+ style="object-fit: cover;">`
+ );
} else {
this.$item_image.html(`<div class="item-abbr">${frappe.get_abbr(item_name)}</div>`);
}
}
+ handle_broken_image($img) {
+ const item_abbr = $($img).attr('alt');
+ $($img).replaceWith(`<div class="item-abbr">${item_abbr}</div>`);
+ }
+
render_discount_dom(item) {
if (item.discount_percentage) {
this.$dicount_section.html(