@@ -436,7 +436,7 @@ def key_virtual_available(move, incoming=False):
436436 prefetch_virtual_available = defaultdict (set )
437437 virtual_available_dict = {}
438438 for move in product_moves :
439- if move .picking_type_id .code in self ._consuming_picking_types () and move .state == 'draft' :
439+ if ( move .picking_type_id .code in self ._consuming_picking_types () or move . _is_inter_wh () ) and move .state == 'draft' :
440440 prefetch_virtual_available [key_virtual_available (move )].add (move .product_id .id )
441441 elif move .picking_type_id .code == 'incoming' :
442442 prefetch_virtual_available [key_virtual_available (move , incoming = True )].add (move .product_id .id )
@@ -445,7 +445,7 @@ def key_virtual_available(move, incoming=False):
445445 virtual_available_dict [key_context ] = {res ['id' ]: res ['virtual_available' ] for res in read_res }
446446
447447 for move in product_moves :
448- if move .picking_type_id .code in self ._consuming_picking_types ():
448+ if move .picking_type_id .code in self ._consuming_picking_types () or move . _is_inter_wh () :
449449 if move .state == 'assigned' :
450450 move .forecast_availability = move .product_uom ._compute_quantity (
451451 move .reserved_availability , move .product_id .uom_id , rounding_method = 'HALF-UP' )
@@ -1185,6 +1185,12 @@ def _should_be_assigned(self):
11851185 self .ensure_one ()
11861186 return bool (not self .picking_id and self .picking_type_id )
11871187
1188+ def _is_inter_wh (self ):
1189+ self .ensure_one ()
1190+ from_wh = self .location_id .warehouse_id
1191+ to_wh = self .location_dest_id .warehouse_id
1192+ return from_wh and to_wh and from_wh != to_wh
1193+
11881194 def _action_confirm (self , merge = True , merge_into = False ):
11891195 """ Confirms stock move or put it in waiting if it's linked to another move.
11901196 :param: merge: According to this boolean, a newly confirmed move will be merged
@@ -2078,6 +2084,8 @@ def _reconcile_out_with_ins(result, out, ins, demand, product_rounding, only_mat
20782084 unreconciled_outs .append ((demand , out ))
20792085
20802086 for demand , out in unreconciled_outs :
2081- _reconcile_out_with_ins (result , out , ins_per_product [product .id ], demand , product_rounding , only_matching_move_dest = False )
2087+ remaining = _reconcile_out_with_ins (result , out , ins_per_product [product .id ], demand , product_rounding , only_matching_move_dest = False )
2088+ if not float_is_zero (remaining , precision_rounding = out .product_id .uom_id .rounding ) and out not in result :
2089+ result [out ] = (- remaining , False )
20822090
20832091 return result
0 commit comments