From 6c767bf8d6d3f8f01a287c8131cfd2c500774390 Mon Sep 17 00:00:00 2001 From: Akhil Narang Date: Mon, 18 Mar 2024 18:38:23 +0530 Subject: [PATCH] fix: skip setting of contact full name if its too long (#25509) Signed-off-by: Akhil Narang --- frappe/patches/v15_0/set_contact_full_name.py | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/frappe/patches/v15_0/set_contact_full_name.py b/frappe/patches/v15_0/set_contact_full_name.py index 6dc3036f34..9ff946b5f7 100644 --- a/frappe/patches/v15_0/set_contact_full_name.py +++ b/frappe/patches/v15_0/set_contact_full_name.py @@ -16,10 +16,16 @@ def execute(): total = len(contacts) for idx, (name, first, middle, last, company) in enumerate(contacts): update_progress_bar("Setting full name for contacts", idx, total) - frappe.db.set_value( - "Contact", - name, - "full_name", - get_full_name(first, middle, last, company), - update_modified=False, - ) + try: + frappe.db.set_value( + "Contact", + name, + "full_name", + get_full_name(first, middle, last, company), + update_modified=False, + ) + except frappe.db.DataError as e: + if frappe.db.is_data_too_long(e): + print("Full name is too long for DB column, skipping") + continue + raise e