@@ -87,7 +87,7 @@ def test_01_purchase_order_manual_delivery(self):
87
87
add second PO line to same picking afterwards)
88
88
"""
89
89
# confirm RFQ
90
- self .po1 .button_confirm_manual ()
90
+ self .po1 .button_confirm ()
91
91
self .assertTrue (self .po1_line1 .pending_to_receive )
92
92
self .assertTrue (self .po1_line2 .pending_to_receive )
93
93
self .assertEqual (self .po1_line1 .qty_in_receipt , 0 )
@@ -225,8 +225,8 @@ def test_02_purchase_order_line_manual_delivery(self):
225
225
for two PO lines from same PO twice.
226
226
"""
227
227
# confirm RFQ
228
- self .po1 .button_confirm_manual ()
229
- self .po2 .button_confirm_manual ()
228
+ self .po1 .button_confirm ()
229
+ self .po2 .button_confirm ()
230
230
self .assertTrue (self .po1_line1 .pending_to_receive )
231
231
self .assertTrue (self .po1_line2 .pending_to_receive )
232
232
self .assertTrue (self .po2_line1 .pending_to_receive )
@@ -279,7 +279,7 @@ def test_03_purchase_order_line_location(self):
279
279
grp_multi_loc = self .env .ref ("stock.group_stock_multi_locations" )
280
280
self .env .user .write ({"groups_id" : [(4 , grp_multi_loc .id , 0 )]})
281
281
# confirm RFQ
282
- self .po1 .button_confirm_manual ()
282
+ self .po1 .button_confirm ()
283
283
self .assertTrue (self .po1_line1 .pending_to_receive )
284
284
self .assertTrue (self .po1_line2 .pending_to_receive )
285
285
self .assertEqual (self .po1_line1 .qty_in_receipt , 0 )
@@ -332,7 +332,7 @@ def test_04_pending_to_receive(self):
332
332
"product_qty" : 5.0 ,
333
333
}
334
334
)
335
- po_existing_bigger .button_confirm_manual ()
335
+ po_existing_bigger .button_confirm ()
336
336
# create a manual delivery for line in po_existing_bigger
337
337
wizard = (
338
338
self .env ["create.stock.picking.wizard" ]
@@ -391,7 +391,7 @@ def test_05_purchase_order_in_progress(self):
391
391
"product_qty" : 5.0 ,
392
392
}
393
393
)
394
- po_in_progress .button_confirm_manual ()
394
+ po_in_progress .button_confirm ()
395
395
location = self .env ["stock.location" ].browse (
396
396
po_in_progress .picking_type_id .default_location_dest_id .id
397
397
)
@@ -470,7 +470,7 @@ def test_06_purchase_order_manual_delivery_double_validation(self):
470
470
)
471
471
472
472
# confirm RFQ
473
- self .po .button_confirm_manual ()
473
+ self .po .button_confirm ()
474
474
self .assertTrue (self .po .order_line .pending_to_receive )
475
475
self .assertEqual (self .po .order_line .qty_in_receipt , 0 )
476
476
self .assertFalse (
@@ -489,3 +489,20 @@ def test_06_purchase_order_manual_delivery_double_validation(self):
489
489
"Purchase Manual Delivery: no picking should had been created" ,
490
490
)
491
491
self .assertEqual (self .po .state , "purchase" )
492
+
493
+ def test_07_purchase_order_ignore_manual_delivery (self ):
494
+ """Manual delivery can be overridden with a context key during confirmation"""
495
+ self .po1 .with_context (ignore_manual_delivery = True ).button_confirm ()
496
+ self .assertTrue (
497
+ self .po1 .picking_ids ,
498
+ "Context key failed to trigger picking creation" ,
499
+ )
500
+ self .assertTrue (
501
+ self .po1 .picking_ids .move_ids ,
502
+ "Context key failed to trigger stock move creation" ,
503
+ )
504
+ for line in self .po1 .order_line :
505
+ self .assertFalse (
506
+ line .pending_to_receive ,
507
+ "Context key did not create stock moves for all quantities" ,
508
+ )
0 commit comments