@ -228,7 +228,9 @@ def update_system_id(name):
doc = frappe . get_doc ( " Procedure " , name )
for table in doc . get ( " procedure_details " ) :
if table . content_type == " Link " :
procedure = table . temp_cnt
frappe . msgprint ( " call " + str ( procedure ) )
system_mapping = frappe . db . sql ( """ select name from {0} .`tabSystem Mapping` where variant_mapping = ' {1} ' and language = ' {2} ' """ . format (
current_db_name , doc . variant_mapping , doc . language ) , as_dict = True )
if system_mapping :
@ -236,11 +238,13 @@ def update_system_id(name):
sys_procedure = frappe . db . sql ( """ select systems,sub_systems,system_id,sub_system_id,`procedure` from {0} .`tabSystem Mapping_Sub System` where parent = ' {1} ' and `procedure` = ' {2} ' """ . format (
current_db_name , sm , table . temp_cnt ) , as_dict = True )
if sys_procedure :
frappe . msgprint ( str ( sys_procedure [ 0 ] [ ' procedure ' ] ) )
if table . temp_cnt == sys_procedure [ 0 ] [ ' procedure ' ] :
sys_id = doc . variant_mapping + ' , ' + \
str ( sys_procedure [ 0 ] [ ' system_id ' ] ) + ' , ' + \
str ( sys_procedure [ 0 ] [ ' sub_system_id ' ] )
table . system_id = sys_id
frappe . msgprint ( str ( sys_id ) )
frappe . db . sql ( """ update {0} .`tabProcedure_Details` set system_id = ' {1} ' where parent = ' {2} ' and temp_cnt = ' {3} ' """ . format (
current_db_name , sys_id , doc . name , table . temp_cnt ) )
frappe . db . commit ( )