File tree Expand file tree Collapse file tree 2 files changed +21
-2
lines changed
Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -118,11 +118,30 @@ def _compute_get_total_rows(self):
118118
119119 def cancel_import (self ):
120120 """
121- The function cancels the import by updating the state of the record to "Cancelled".
121+ Cancel the import and create a new import record to start fresh.
122+ Redirects to the newly created record.
122123 """
123124 for rec in self :
124125 rec .update ({"state" : self .CANCELLED })
125126
127+ # Create a new area import record
128+ new_record = self .env ["spp.area.import" ].create (
129+ {
130+ "name" : _ ("New Area Import" ),
131+ "state" : self .NEW ,
132+ }
133+ )
134+
135+ # Return action to open the new record in form view
136+ return {
137+ "type" : "ir.actions.act_window" ,
138+ "res_model" : "spp.area.import" ,
139+ "res_id" : new_record .id ,
140+ "view_mode" : "form" ,
141+ "target" : "current" ,
142+ "context" : self .env .context ,
143+ }
144+
126145 def reset_to_uploaded (self ):
127146 """
128147 The function resets the state of a record to "Uploaded".
Original file line number Diff line number Diff line change 3333 <button
3434 name =" cancel_import"
3535 type =" object"
36- string =" Cancel"
36+ string =" Cancel and Re-import "
3737 class =" btn-danger"
3838 invisible =" state not in ('Uploaded', 'Imported', 'Validated')"
3939 />
You can’t perform that action at this time.
0 commit comments