File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed
spp_custom_fields_ui/static/src/js Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -16,16 +16,25 @@ patch(FormController.prototype, {
1616 return super . saveButtonClicked ( params ) ;
1717 }
1818
19+ // Check if this is a new record (before save)
20+ const isNewRecord = ! this . model . root . resId ;
21+
1922 // Try to save
2023 try {
2124 const result = await super . saveButtonClicked ( params ) ;
2225
2326 // Only reload if save was successful
24- // If result is defined and not false, save was successful
2527 if ( result !== false ) {
26- // Reload the page to refresh the model registry
27- // The URL will contain the record ID (for both new and existing records)
28- window . location . reload ( ) ;
28+ if ( isNewRecord ) {
29+ // For new records, wait a bit for URL to update, then reload
30+ // This ensures the URL contains the new record ID
31+ setTimeout ( ( ) => {
32+ window . location . reload ( ) ;
33+ } , 100 ) ;
34+ } else {
35+ // For existing records, reload immediately
36+ window . location . reload ( ) ;
37+ }
2938 }
3039
3140 return result ;
You can’t perform that action at this time.
0 commit comments