Merge pull request #52096 from frappe/mergify/bp/version-15-hotfix/pr-52088

fix: show message if image is removed from item description (backport #52088)
This commit is contained in:
Mihir Kandoi
2026-01-27 14:56:03 +05:30
committed by GitHub

View File

@@ -228,8 +228,25 @@ class Item(Document):
def validate_description(self):
"""Clean HTML description if set"""
if cint(frappe.db.get_single_value("Stock Settings", "clean_description_html")):
old_desc = self.description
self.description = clean_html(self.description)
if (
old_desc
and self.description
and "<img src" in old_desc
and "<img src" not in self.description
):
frappe.msgprint(
_(
'Image in the description has been removed. To disable this behavior, uncheck "{0}" in {1}.'
).format(
frappe.get_meta("Stock Settings").get_label("clean_description_html"),
get_link_to_form("Stock Settings"),
),
alert=True,
)
def validate_customer_provided_part(self):
if self.is_customer_provided_item:
if self.is_purchase_item: