fix: skip setting of contact full name if its too long (#25509)

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
This commit is contained in:
Akhil Narang 2024-03-18 18:38:23 +05:30 committed by GitHub
parent 56f1ed4fb3
commit 6c767bf8d6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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