diff --git a/smart_service/apis/master_api.py b/smart_service/apis/master_api.py index 72632d8..7b1629a 100644 --- a/smart_service/apis/master_api.py +++ b/smart_service/apis/master_api.py @@ -394,7 +394,7 @@ def change_file_dir(): "~") + "/frappe-bench/sites/" + site_name + "/public" file_data = frappe.db.sql(''' select name,file from tabProcedure_Details where content_type = 'File' and file = '/files/Driver Seat Back Rest Foam.jpg' ;''', as_dict=1) - + changed_file_list = [] for d in file_data: frappe.log_error("File data :", str(d)) path = d['file'] @@ -418,16 +418,13 @@ def change_file_dir(): new_file_dir = base_path + new_full_path if os.path.exists(new_file_dir): - frappe.log_error("final", str( - 'ext changed File exists in local:' + str(new_file_dir))) - else: - frappe.log_error("final", str( - 'File Not exists: ' + new_file_dir)) - # frappe.db.sql(f''' - # update tabProcedure_Details set file = '{new_full_path}' where content_type = 'File' and name = '{d['name']}'; - # ''') - # frappe.db.commit() + changed_file_list.append(str(new_full_path)) + frappe.db.sql(f''' + update tabProcedure_Details set file = '{new_full_path}' where content_type = 'File' and name = '{d['name']}'; + ''') + frappe.db.commit() + frappe.log_error("ALL updated files", str(changed_file_list)) if file_data: return file_data else: