File tree Expand file tree Collapse file tree 2 files changed +10
-9
lines changed Expand file tree Collapse file tree 2 files changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -260,13 +260,14 @@ def create(self, vals):
260
260
is_button = fields .Boolean (default = False )
261
261
262
262
def write (self , vals ):
263
- if vals .get ("stage_id" , False ) and vals .get ("is_button" , False ):
264
- vals ["is_button" ] = False
265
- else :
266
- stage_id = self .env ["fsm.stage" ].browse (vals .get ("stage_id" ))
267
- if stage_id == self .env .ref ("fieldservice.fsm_stage_completed" ):
268
- raise UserError (_ ("Cannot move to completed from Kanban" ))
269
- self ._calc_scheduled_dates (vals )
263
+ for record in self :
264
+ if vals .get ("stage_id" , False ) and vals .get ("is_button" , False ):
265
+ vals ["is_button" ] = False
266
+ else :
267
+ stage_id = self .env ["fsm.stage" ].browse (vals .get ("stage_id" ))
268
+ if stage_id == self .env .ref ("fieldservice.fsm_stage_completed" ):
269
+ raise UserError (_ ("Cannot move to completed from Kanban" ))
270
+ record ._calc_scheduled_dates (vals )
270
271
res = super ().write (vals )
271
272
return res
272
273
Original file line number Diff line number Diff line change @@ -256,15 +256,15 @@ def test_fsm_order(self):
256
256
)
257
257
)
258
258
self .assertTrue (data , "It should be able to read group" )
259
- self .Order .write (
259
+ self .order .write (
260
260
{
261
261
"location_id" : self .test_location .id ,
262
262
"stage_id" : self .stage1 .id ,
263
263
"is_button" : True ,
264
264
}
265
265
)
266
266
with self .assertRaises (UserError ):
267
- self .Order .write (
267
+ self .order .write (
268
268
{
269
269
"location_id" : self .test_location .id ,
270
270
"stage_id" : self .stage1 .id ,
You can’t perform that action at this time.
0 commit comments