From 4faa3c1f65bf17d5841ed623602d308545c80644 Mon Sep 17 00:00:00 2001 From: venkataakhil Date: Wed, 12 Apr 2023 18:08:39 +0530 Subject: [PATCH] Replace asset path with file path --- smart_service/apis/master_api.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/smart_service/apis/master_api.py b/smart_service/apis/master_api.py index 599cc10..eb429fd 100644 --- a/smart_service/apis/master_api.py +++ b/smart_service/apis/master_api.py @@ -378,7 +378,13 @@ def change_file_dir(): pass def asset_to_files_path(): - frappe.db.sql(''' - update tabProcedure_Details set file =concat('/files/',SUBSTRING_INDEX(file,'/',-1)) where content_type = 'File' and file like '%Asset/%'; - ''') - frappe.db.commit() \ No newline at end of file + try: + count = frappe.db.sql(''' + select count(*) from tabProcedure_Details where content_type = 'File' and file like '%Asset/%';''') + frappe.db.sql(''' + update tabProcedure_Details set file =concat('/files/',SUBSTRING_INDEX(file,'/',-1)) where content_type = 'File' and file like '%Asset/%'; + ''') + frappe.db.commit() + return count + except: + return False \ No newline at end of file