@@ -325,8 +325,43 @@ def test_11_xml_import(self):
325
325
326
326
def test_12_xml_import (self ):
327
327
res = self .run_wizard ("test12" , "IT05979361218_008.xml" )
328
- invoice_id = res .get ("domain" )[0 ][2 ][0 ]
329
- invoice = self .invoice_model .browse (invoice_id )
328
+
329
+ # Case where the confirmation wizard is shown
330
+ if res .get ("res_model" ) == "wizard.check.intermediary" :
331
+ # Simulate opening the wizard and retrieving values from the context
332
+ context = res .get ("context" , {})
333
+ intermediary_id = context .get ("intermediary_id" )
334
+ invoice_id = context .get ("invoice_id" )
335
+
336
+ # Check that the wizard was opened with the correct values
337
+ self .assertTrue (intermediary_id , "intermediary_id not present in context" )
338
+ self .assertTrue (invoice_id , "invoice_id not present in context" )
339
+
340
+ # Simulate the wizard
341
+ wizard = (
342
+ self .env ["wizard.check.intermediary" ]
343
+ .with_context (context )
344
+ .create (
345
+ {
346
+ "message" : context .get ("default_message" ),
347
+ "intermediary_id" : intermediary_id ,
348
+ "invoice_id" : invoice_id ,
349
+ }
350
+ )
351
+ )
352
+
353
+ # Simulate user confirmation
354
+ wizard .action_confirm ()
355
+
356
+ # After confirmation, retrieve the invoice and check the intermediary partner
357
+ invoice = self .env ["account.move" ].browse (invoice_id )
358
+
359
+ else :
360
+ # Standard flow without wizard
361
+ invoice_id = res .get ("domain" )[0 ][2 ][0 ]
362
+ invoice = self .env ["account.move" ].browse (invoice_id )
363
+
364
+ # Final assertions regardless of the path
330
365
self .assertEqual (invoice .payment_reference , "FT/2015/0012" )
331
366
self .assertEqual (invoice .sender , "TZ" )
332
367
self .assertEqual (invoice .intermediary .name , "MARIO ROSSI" )
0 commit comments