diff --git a/erpnext/patches/v5_0/update_item_description_and_image.py b/erpnext/patches/v5_0/update_item_description_and_image.py index 7e61314b7a3..6b4705205e4 100644 --- a/erpnext/patches/v5_0/update_item_description_and_image.py +++ b/erpnext/patches/v5_0/update_item_description_and_image.py @@ -30,7 +30,8 @@ def execute(): count = 1 for d in records: - if cstr(d.description) == item_details.get(d.item_code).old_description: + if d.item_code and item_details.get(d.item_code) \ + and cstr(d.description) == item_details.get(d.item_code).old_description: image_url = item_details.get(d.item_code).image_url desc = item_details.get(d.item_code).new_description else: