@@ -190,8 +190,7 @@ def _create_case_from_story(self, story, fake, beneficiaries):
190190 "case_worker_id" : self .env .user .id ,
191191 }
192192
193- case = self .env ["spp.case" ].sudo ().create (vals ) # nosemgrep: semgrep.odoo-sudo-without-context
194-
193+ case = self .env ["spp.case" ].sudo ().create (vals )
195194 # Backdate creation
196195 self .env .cr .execute (
197196 "UPDATE spp_case SET create_date = %s WHERE id = %s" ,
@@ -219,8 +218,7 @@ def _process_case_journey(self, case, journey, fake):
219218 action_date = fields .Date .today () - timedelta (days = days_back )
220219
221220 if action == "create_plan" :
222- current_plan = Plan .sudo ().create ( # nosemgrep: semgrep.odoo-sudo-without-context
223- {
221+ current_plan = Plan .sudo ().create ( {
224222 "case_id" : case .id ,
225223 "name" : step .get ("plan_name" , f"Plan for { case .partner_id .name } " ),
226224 "is_current" : True ,
@@ -231,8 +229,7 @@ def _process_case_journey(self, case, journey, fake):
231229 )
232230
233231 elif action == "add_intervention" and current_plan :
234- Intervention .sudo ().create ( # nosemgrep: semgrep.odoo-sudo-without-context
235- {
232+ Intervention .sudo ().create ( {
236233 "plan_id" : current_plan .id ,
237234 "name" : step .get ("intervention" , "Intervention" ),
238235 "description" : fake .sentence (),
@@ -250,12 +247,10 @@ def _process_case_journey(self, case, journey, fake):
250247 limit = 1 ,
251248 )
252249 if intervention :
253- intervention .sudo ().write ({"state" : "completed" }) # nosemgrep: semgrep.odoo-sudo-without-context
254-
250+ intervention .sudo ().write ({"state" : "completed" })
255251 elif action in ("home_visit" , "office_visit" , "final_visit" ):
256252 visit_type = "home" if action != "office_visit" else "office"
257- Visit .sudo ().create ( # nosemgrep: semgrep.odoo-sudo-without-context
258- {
253+ Visit .sudo ().create ( {
259254 "case_id" : case .id ,
260255 "visit_type" : visit_type ,
261256 "purpose" : step .get ("purpose" , "Check-in visit" ),
@@ -265,8 +260,7 @@ def _process_case_journey(self, case, journey, fake):
265260 )
266261
267262 elif action == "progress_note" :
268- Note .sudo ().create ( # nosemgrep: semgrep.odoo-sudo-without-context
269- {
263+ Note .sudo ().create ( {
270264 "case_id" : case .id ,
271265 "note_type" : "progress" ,
272266 "content" : step .get ("note" , fake .paragraph ()),
@@ -275,8 +269,7 @@ def _process_case_journey(self, case, journey, fake):
275269 )
276270
277271 elif action in ("assessment" , "emergency_assessment" , "safety_assessment" ):
278- Note .sudo ().create ( # nosemgrep: semgrep.odoo-sudo-without-context
279- {
272+ Note .sudo ().create ( {
280273 "case_id" : case .id ,
281274 "note_type" : "assessment" ,
282275 "content" : step .get (
@@ -289,8 +282,7 @@ def _process_case_journey(self, case, journey, fake):
289282 elif action == "add_referral" :
290283 service = self ._get_or_create_service (step .get ("service" , "External Service" ))
291284 if service :
292- Referral .sudo ().create ( # nosemgrep: semgrep.odoo-sudo-without-context
293- {
285+ Referral .sudo ().create ( {
294286 "case_id" : case .id ,
295287 "service_id" : service .id ,
296288 "referral_reason" : step .get ("reason" , "Service needed" ),
@@ -307,15 +299,13 @@ def _process_case_journey(self, case, journey, fake):
307299 limit = 1 ,
308300 )
309301 if closure_stage :
310- case .sudo ().write ( # nosemgrep: semgrep.odoo-sudo-without-context
311- {
302+ case .sudo ().write ( {
312303 "stage_id" : closure_stage .id ,
313304 "actual_closure_date" : action_date ,
314305 }
315306 )
316307 if current_plan :
317- current_plan .sudo ().write ({"state" : "completed" }) # nosemgrep: semgrep.odoo-sudo-without-context
318-
308+ current_plan .sudo ().write ({"state" : "completed" })
319309 def _create_random_case (self , fake , beneficiaries ):
320310 """Create a random case with realistic data."""
321311 # Random date within range
@@ -352,8 +342,7 @@ def _create_random_case(self, fake, beneficiaries):
352342 "case_worker_id" : self .env .user .id ,
353343 }
354344
355- case = self .env ["spp.case" ].sudo ().create (vals ) # nosemgrep: semgrep.odoo-sudo-without-context
356-
345+ case = self .env ["spp.case" ].sudo ().create (vals )
357346 # Backdate creation
358347 self .env .cr .execute (
359348 "UPDATE spp_case SET create_date = %s WHERE id = %s" ,
@@ -381,8 +370,7 @@ def _add_random_plan(self, case, fake, intake_date):
381370 Plan = self .env ["spp.case.intervention.plan" ]
382371 Intervention = self .env ["spp.case.intervention" ]
383372
384- plan = Plan .sudo ().create ( # nosemgrep: semgrep.odoo-sudo-without-context
385- {
373+ plan = Plan .sudo ().create ( {
386374 "case_id" : case .id ,
387375 "name" : f"Support Plan - { case .partner_id .name or 'Client' } " ,
388376 "is_current" : True ,
@@ -403,8 +391,7 @@ def _add_random_plan(self, case, fake, intake_date):
403391 ]
404392
405393 for _i in range (random .randint (2 , 4 )):
406- Intervention .sudo ().create ( # nosemgrep: semgrep.odoo-sudo-without-context
407- {
394+ Intervention .sudo ().create ( {
408395 "plan_id" : plan .id ,
409396 "name" : random .choice (intervention_names ),
410397 "description" : fake .sentence (),
@@ -419,8 +406,7 @@ def _add_random_visits(self, case, fake, intake_date):
419406
420407 for _i in range (random .randint (1 , 3 )):
421408 visit_date = intake_date + timedelta (days = random .randint (5 , 60 ))
422- Visit .sudo ().create ( # nosemgrep: semgrep.odoo-sudo-without-context
423- {
409+ Visit .sudo ().create ( {
424410 "case_id" : case .id ,
425411 "visit_type" : random .choice (["home" , "office" , "phone" , "virtual" ]),
426412 "purpose" : fake .sentence (nb_words = 5 ),
@@ -435,8 +421,7 @@ def _add_random_notes(self, case, fake, intake_date):
435421
436422 for _i in range (random .randint (1 , 4 )):
437423 note_date = intake_date + timedelta (days = random .randint (1 , 60 ))
438- Note .sudo ().create ( # nosemgrep: semgrep.odoo-sudo-without-context
439- {
424+ Note .sudo ().create ( {
440425 "case_id" : case .id ,
441426 "note_type" : random .choice (["progress" , "assessment" , "general" , "supervision" ]),
442427 "content" : fake .paragraph (nb_sentences = random .randint (2 , 5 )),
@@ -455,8 +440,7 @@ def _close_random_case(self, case, fake, intake_date):
455440
456441 if closure_stage :
457442 closure_date = intake_date + timedelta (days = random .randint (30 , 90 ))
458- case .sudo ().write ( # nosemgrep: semgrep.odoo-sudo-without-context
459- {
443+ case .sudo ().write ( {
460444 "stage_id" : closure_stage .id ,
461445 "actual_closure_date" : closure_date ,
462446 }
@@ -488,8 +472,7 @@ def _get_or_create_case_type(self, type_name):
488472 CaseType = self .env ["spp.case.type" ]
489473 case_type = CaseType .search ([("name" , "=" , type_name )], limit = 1 )
490474 if not case_type :
491- case_type = CaseType .sudo ().create ( # nosemgrep: semgrep.odoo-sudo-without-context
492- {
475+ case_type = CaseType .sudo ().create ( {
493476 "name" : type_name ,
494477 "code" : type_name .upper ().replace (" " , "_" )[:10 ],
495478 }
@@ -545,8 +528,7 @@ def _get_or_create_service(self, service_name):
545528 Service = self .env ["spp.service" ]
546529 service = Service .search ([("name" , "=" , service_name )], limit = 1 )
547530 if not service :
548- service = Service .sudo ().create ( # nosemgrep: semgrep.odoo-sudo-without-context
549- {
531+ service = Service .sudo ().create ( {
550532 "name" : service_name ,
551533 "service_type" : "external" ,
552534 }
0 commit comments