#NEWLINE# @ frappe . whitelist ( ) #NEWLINE# def restore( version ) : #NEWLINE# #INDENT# if ( not ( 'System Manager' in frappe . get_roles ( ) ) ) : #NEWLINE# #INDENT# raise frappe . PermissionError #NEWLINE# #UNINDENT# version = frappe . get_doc ( 'Version' , version ) #NEWLINE# docdict = json . loads ( version . doclist_json ) #NEWLINE# if ( docdict . get ( 'name' ) != version . docname ) : #NEWLINE# #INDENT# docdict [ 'name' ] = docdict . docname #NEWLINE# #UNINDENT# docdict [ 'modified' ] = frappe . db . get_value ( version . ref_doctype , version . docname , 'modified' ) #NEWLINE# frappe . get_doc ( docdict ) . save ( )