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:
parent
56f1ed4fb3
commit
6c767bf8d6
1 changed files with 13 additions and 7 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue