@@ -263,3 +263,42 @@ def test_04_write_uid(self):
263263 self .assertEqual (contact .id , contact_id )
264264 self .assertEqual (contact .ref , "abc" )
265265 self .assertEqual (contact .write_uid , self .admin_user )
266+
267+ def test_05_create_uid_on_transient_model (self ):
268+ """Check the create_uid of records created
269+ during an impersonated session on a transient model"""
270+ # Login as admin
271+ self .authenticate (user = "admin" , password = "admin" )
272+
273+ # Impersonate demo user and create a wizard record
274+ self ._impersonate_user (self .demo_user )
275+
276+ response = self .url_open (
277+ "/web/dataset/call_kw/mail.wizard.invite/web_save" ,
278+ data = json .dumps (
279+ {
280+ "params" : {
281+ "model" : "mail.wizard.invite" ,
282+ "method" : "web_save" ,
283+ "args" : [
284+ [],
285+ {
286+ "res_model" : "res.partner" ,
287+ "message" : "Hello" ,
288+ },
289+ {},
290+ ],
291+ "kwargs" : {},
292+ },
293+ }
294+ ),
295+ headers = {"Content-Type" : "application/json" },
296+ )
297+ self .assertEqual (response .status_code , 200 )
298+ data = response .json ()
299+ result = data ["result" ]
300+ settings_id = result [0 ]["id" ]
301+
302+ wizard = self .env ["mail.wizard.invite" ].browse (settings_id )
303+ self .assertIn ("Hello" , wizard .message )
304+ self .assertEqual (wizard .create_uid , self .demo_user )
0 commit comments