@@ -182,6 +182,32 @@ def test_search_individuals_success(self):
182182 self .assertIn ("links" , data )
183183 self .assertIn ("total" , data ["meta" ])
184184
185+ def test_search_skips_individuals_without_identifiers (self ):
186+ """Search skips individuals without valid identifiers instead of crashing"""
187+ # Create individual then remove all registry IDs
188+ no_id = self .env ["res.partner" ].create (
189+ {
190+ "name" : "No Identifiers Search" ,
191+ "is_registrant" : True ,
192+ "is_group" : False ,
193+ }
194+ )
195+ # Ensure no reg_ids exist
196+ no_id .reg_ids .unlink ()
197+
198+ response = self .url_open (self .api_base_url , headers = self ._get_headers ())
199+
200+ self .assertEqual (response .status_code , 200 )
201+ data = json .loads (response .content )
202+ # Should succeed — no-identifier record silently skipped
203+ self .assertIn ("data" , data )
204+ # Verify the no-identifier individual is not in results
205+ for resource in data .get ("data" , []):
206+ self .assertNotEqual (
207+ resource .get ("name" , {}).get ("given" , "" ),
208+ "No Identifiers Search" ,
209+ )
210+
185211 def test_search_by_name (self ):
186212 """Search with name parameter filters results"""
187213 url = f"{ self .api_base_url } ?name=Jane"
0 commit comments