Fixed bug for internal load order when UdCs belong to several locations.

This commit refs #25451
This commit is contained in:
Nicolás López Solano 2023-01-09 13:36:35 +01:00
parent 48b269aa63
commit c833700836
1 changed files with 4 additions and 3 deletions

View File

@ -205,12 +205,13 @@ class LoadOrder(metaclass=PoolMeta):
def _get_shipment_internal(self):
shipment = super()._get_shipment_internal()
if self.unit_loads:
from_locations = set([ul.location for ul in self.unit_loads])
from_locations = set([ul.at_warehouse for ul in self.unit_loads])
if len(from_locations) > 1:
raise UserError(gettext(
'carrier_load_ul.msg_carrier_load_order_many_ul_locations',
order=self.rec_name))
shipment.from_location = from_locations.pop()
warehouse = from_locations.pop()
shipment.from_location = warehouse.storage_location
return shipment
def _get_shipment_moves(self, origin, grouped_items):
@ -227,7 +228,7 @@ class LoadOrder(metaclass=PoolMeta):
for item in grouped_items:
if self.type == 'internal':
from_location = item.location
from_location = item.at_warehouse.storage_location
item.check_to_move(from_location, to_location, self.end_date)
new_moves = item._get_new_moves({
'from_location': from_location.id,