Add warehouse in csv key for shipment in.

This commit refs #13317
This commit is contained in:
Sergio Morillo 2020-05-16 15:19:46 +02:00
parent 17fe9febc0
commit f3a5ee1bce
3 changed files with 8 additions and 4 deletions

View File

@ -49,7 +49,7 @@ class ShipmentIn(ShipmentCSVMixin, metaclass=PoolMeta):
@classmethod
def _get_csv_key(cls):
return ('supplier', 'reference', )
return ('supplier', 'reference', 'warehouse', )
def _set_csv_move_locations(self, move):
move.from_location = self.on_change_with_supplier_location()

View File

@ -121,8 +121,8 @@ class ShipmentCSVMixin(object):
csv_file = csv.reader(csv_file, delimiter=csv_delimiter)
headers = next(csv_file)
unique_key = dict([
(d, i) for i, d in enumerate(config_header)
if d in cls._get_csv_key()])
(d.split('.')[0], i) for i, d in enumerate(config_header)
if d.split('.')[0] in cls._get_csv_key()])
data = OrderedDict()
assert len(headers) == len(config_header)

View File

@ -137,8 +137,12 @@ CSV import shipment in wizard::
>>> csv_import.execute('import_')
>>> shipment_in.reload()
>>> len(shipment_in.moves)
1
>>> shipments = ShipmentIn.find([])
>>> len(shipments)
2
>>> shipment_in.moves[0].to_location == wh2.input_location
>>> new_shipment = sorted(shipments, key=lambda s: s.id)[-1]
>>> new_shipment.moves[0].to_location == wh2.input_location
True
When location cross reference does not exist::