@@ -90,8 +90,8 @@ def test_01_purchase_order_manual_delivery(self):
90
90
self .po1 .button_confirm_manual ()
91
91
self .assertTrue (self .po1_line1 .pending_to_receive )
92
92
self .assertTrue (self .po1_line2 .pending_to_receive )
93
- self .assertEqual (self .po1_line1 .existing_qty , 0 )
94
- self .assertEqual (self .po1_line2 .existing_qty , 0 )
93
+ self .assertEqual (self .po1_line1 .qty_in_receipt , 0 )
94
+ self .assertEqual (self .po1_line2 .qty_in_receipt , 0 )
95
95
self .assertFalse (
96
96
self .po1 .picking_ids ,
97
97
"Purchase Manual Delivery: no picking should had been created" ,
@@ -172,8 +172,8 @@ def test_01_purchase_order_manual_delivery(self):
172
172
)
173
173
self .assertFalse (self .po1_line1 .pending_to_receive )
174
174
self .assertFalse (self .po1_line2 .pending_to_receive )
175
- self .assertEqual (self .po1_line1 .existing_qty , self .po1_line1 .product_qty )
176
- self .assertEqual (self .po1_line2 .existing_qty , self .po1_line2 .product_qty )
175
+ self .assertEqual (self .po1_line1 .qty_in_receipt , self .po1_line1 .product_qty )
176
+ self .assertEqual (self .po1_line2 .qty_in_receipt , self .po1_line2 .product_qty )
177
177
self .assertFalse (self .po1 .pending_to_receive )
178
178
179
179
# Process the picking
@@ -209,11 +209,11 @@ def test_01_purchase_order_manual_delivery(self):
209
209
)
210
210
return_wiz .create_returns ()
211
211
212
- # The refund line is open to receive the returned item
212
+ # The refund line is open to re- receive the returned item
213
213
self .assertTrue (self .po1_line1 .pending_to_receive )
214
- self .assertEqual (self .po1_line1 .existing_qty , self . po1_line1 . product_qty - 2 )
214
+ self .assertEqual (self .po1_line1 .qty_in_receipt , - 2 )
215
215
# But the non-refund line is not
216
- self .assertEqual (self .po1_line2 .existing_qty , self . po1_line2 . product_qty )
216
+ self .assertFalse (self .po1_line2 .qty_in_receipt )
217
217
self .assertFalse (self .po1_line2 .pending_to_receive )
218
218
219
219
self .assertTrue (self .po1 .pending_to_receive )
@@ -231,10 +231,10 @@ def test_02_purchase_order_line_manual_delivery(self):
231
231
self .assertTrue (self .po1_line2 .pending_to_receive )
232
232
self .assertTrue (self .po2_line1 .pending_to_receive )
233
233
self .assertTrue (self .po2_line2 .pending_to_receive )
234
- self .assertEqual (self .po1_line1 .existing_qty , 0 )
235
- self .assertEqual (self .po1_line2 .existing_qty , 0 )
236
- self .assertEqual (self .po2_line1 .existing_qty , 0 )
237
- self .assertEqual (self .po2_line2 .existing_qty , 0 )
234
+ self .assertEqual (self .po1_line1 .qty_in_receipt , 0 )
235
+ self .assertEqual (self .po1_line2 .qty_in_receipt , 0 )
236
+ self .assertEqual (self .po2_line1 .qty_in_receipt , 0 )
237
+ self .assertEqual (self .po2_line2 .qty_in_receipt , 0 )
238
238
with self .assertRaises (UserError ):
239
239
# create a manual delivery for two lines different PO
240
240
self .env ["create.stock.picking.wizard" ].with_context (
@@ -266,10 +266,10 @@ def test_02_purchase_order_line_manual_delivery(self):
266
266
self .assertTrue (self .po1_line2 .pending_to_receive )
267
267
self .assertFalse (self .po2_line1 .pending_to_receive )
268
268
self .assertFalse (self .po2_line2 .pending_to_receive )
269
- self .assertEqual (self .po1_line1 .existing_qty , 0 )
270
- self .assertEqual (self .po1_line2 .existing_qty , 0 )
271
- self .assertEqual (self .po2_line1 .existing_qty , self .po2_line1 .product_qty )
272
- self .assertEqual (self .po2_line2 .existing_qty , self .po2_line2 .product_qty )
269
+ self .assertEqual (self .po1_line1 .qty_in_receipt , 0 )
270
+ self .assertEqual (self .po1_line2 .qty_in_receipt , 0 )
271
+ self .assertEqual (self .po2_line1 .qty_in_receipt , self .po2_line1 .product_qty )
272
+ self .assertEqual (self .po2_line2 .qty_in_receipt , self .po2_line2 .product_qty )
273
273
274
274
def test_03_purchase_order_line_location (self ):
275
275
"""
@@ -282,8 +282,8 @@ def test_03_purchase_order_line_location(self):
282
282
self .po1 .button_confirm_manual ()
283
283
self .assertTrue (self .po1_line1 .pending_to_receive )
284
284
self .assertTrue (self .po1_line2 .pending_to_receive )
285
- self .assertEqual (self .po1_line1 .existing_qty , 0 )
286
- self .assertEqual (self .po1_line2 .existing_qty , 0 )
285
+ self .assertEqual (self .po1_line1 .qty_in_receipt , 0 )
286
+ self .assertEqual (self .po1_line2 .qty_in_receipt , 0 )
287
287
# create a manual delivery for one line (product1)
288
288
wizard = (
289
289
self .env ["create.stock.picking.wizard" ]
@@ -307,8 +307,8 @@ def test_03_purchase_order_line_location(self):
307
307
self .assertEqual (picking_id .location_dest_id , self .shelf2 )
308
308
self .assertFalse (self .po1_line1 .pending_to_receive )
309
309
self .assertTrue (self .po1_line2 .pending_to_receive )
310
- self .assertEqual (self .po1_line1 .existing_qty , self .po1_line1 .product_qty )
311
- self .assertEqual (self .po1_line2 .existing_qty , 0 )
310
+ self .assertEqual (self .po1_line1 .qty_in_receipt , self .po1_line1 .product_qty )
311
+ self .assertEqual (self .po1_line2 .qty_in_receipt , 0 )
312
312
313
313
def test_04_pending_to_receive (self ):
314
314
"""
@@ -409,11 +409,22 @@ def test_05_purchase_order_in_progress(self):
409
409
wizard .line_ids [0 ].qty = 2
410
410
wizard .create_stock_picking ()
411
411
po_in_progress .picking_ids [0 ].button_validate ()
412
+
413
+ self .assertEqual (po_in_progress .order_line .qty_received , 2 )
414
+ self .assertEqual (po_in_progress .order_line .qty_in_receipt , 0 )
415
+ self .assertTrue (po_in_progress .order_line .pending_to_receive )
416
+
412
417
qty , _ = product_in_progress ._get_quantity_in_progress (
413
418
location_ids = location .ids
414
419
)
415
420
self .assertEqual (qty .get ((product_in_progress .id , location .id )), 3 )
416
421
422
+ wizard .line_ids [0 ].qty = 3
423
+ wizard .create_stock_picking ()
424
+ self .assertEqual (po_in_progress .order_line .qty_received , 2 )
425
+ self .assertEqual (po_in_progress .order_line .qty_in_receipt , 3 )
426
+ self .assertFalse (po_in_progress .order_line .pending_to_receive )
427
+
417
428
def test_06_purchase_order_manual_delivery_double_validation (self ):
418
429
"""
419
430
Confirm Purchase Order 1, check no incoming shipments have been
@@ -460,7 +471,7 @@ def test_06_purchase_order_manual_delivery_double_validation(self):
460
471
# confirm RFQ
461
472
self .po .button_confirm_manual ()
462
473
self .assertTrue (self .po .order_line .pending_to_receive )
463
- self .assertEqual (self .po .order_line .existing_qty , 0 )
474
+ self .assertEqual (self .po .order_line .qty_in_receipt , 0 )
464
475
self .assertFalse (
465
476
self .po .picking_ids ,
466
477
"Purchase Manual Delivery: no picking should had been created" ,
@@ -471,7 +482,7 @@ def test_06_purchase_order_manual_delivery_double_validation(self):
471
482
self .po .env .user .groups_id += self .env .ref ("purchase.group_purchase_manager" )
472
483
self .po .button_approve ()
473
484
self .assertTrue (self .po .order_line .pending_to_receive )
474
- self .assertEqual (self .po .order_line .existing_qty , 0 )
485
+ self .assertEqual (self .po .order_line .qty_in_receipt , 0 )
475
486
self .assertFalse (
476
487
self .po .picking_ids ,
477
488
"Purchase Manual Delivery: no picking should had been created" ,
0 commit comments