File tree Expand file tree Collapse file tree 2 files changed +34
-6
lines changed Expand file tree Collapse file tree 2 files changed +34
-6
lines changed Original file line number Diff line number Diff line change @@ -61,15 +61,31 @@ def _find_buffers_to_update_nfp(self):
61
61
out_buffers = in_buffers = self .env ["stock.buffer" ]
62
62
for move in self :
63
63
out_buffers |= move .mapped ("product_id.buffer_ids" ).filtered (
64
- lambda buffer : (
65
- move .location_id .is_sublocation_of (buffer .location_id ) # noqa: B023
66
- and not move .location_dest_id .is_sublocation_of (buffer .location_id ) # noqa: B023
64
+ lambda buffer , move = move : (
65
+ move .location_id .is_sublocation_of (buffer .location_id )
66
+ and (
67
+ not move .location_dest_id .is_sublocation_of (buffer .location_id )
68
+ or (
69
+ move .location_final_id
70
+ and not move .location_final_id .is_sublocation_of (
71
+ buffer .location_id
72
+ )
73
+ )
74
+ )
67
75
)
68
76
)
69
77
in_buffers |= move .mapped ("product_id.buffer_ids" ).filtered (
70
- lambda buffer : (
71
- not move .location_id .is_sublocation_of (buffer .location_id ) # noqa: B023
72
- and move .location_dest_id .is_sublocation_of (buffer .location_id ) # noqa: B023
78
+ lambda buffer , move = move : (
79
+ not move .location_id .is_sublocation_of (buffer .location_id )
80
+ and (
81
+ move .location_dest_id .is_sublocation_of (buffer .location_id )
82
+ or (
83
+ move .location_final_id
84
+ and move .location_final_id .is_sublocation_of (
85
+ buffer .location_id
86
+ )
87
+ )
88
+ )
73
89
)
74
90
)
75
91
return out_buffers , in_buffers
Original file line number Diff line number Diff line change @@ -1344,6 +1344,12 @@ def test_47_incoming_quantity_from_final_location(self):
1344
1344
self .assertEqual (move .location_dest_id , self .warehouse .wh_input_stock_loc_id )
1345
1345
self .assertEqual (move .location_final_id , self .warehouse .lot_stock_id )
1346
1346
self .assertEqual (move .product_qty , 225 )
1347
+ _ob , in_buffers = move ._find_buffers_to_update_nfp ()
1348
+ self .assertIn (
1349
+ self .buffer_purchase ,
1350
+ in_buffers ,
1351
+ "Buffer won't be found for auto-NFP update" ,
1352
+ )
1347
1353
self .buffer_purchase .cron_actions ()
1348
1354
self .assertEqual (self .buffer_purchase .incoming_dlt_qty , 225.0 )
1349
1355
# Validating should generate the next picking.
@@ -1411,6 +1417,12 @@ def test_48_outgoing_quantity_with_final_location(self):
1411
1417
# Validating should generate the next picking.
1412
1418
self .assertFalse (move .move_dest_ids )
1413
1419
picking_1 = move .picking_id
1420
+ out_buffers , _ib = move ._find_buffers_to_update_nfp ()
1421
+ self .assertIn (
1422
+ self .buffer_purchase ,
1423
+ out_buffers ,
1424
+ "Buffer won't be found for auto-NFP update" ,
1425
+ )
1414
1426
self ._do_picking (picking_1 , datetime .today ())
1415
1427
self .assertEqual (len (move .move_dest_ids ), 1 )
1416
1428
picking_2 = move .move_dest_ids .picking_id
You can’t perform that action at this time.
0 commit comments