Process all cps levels
Fix bug when matching moves are searched
This commit is contained in:
parent
1a52e73c05
commit
788970809c
2
setup.py
2
setup.py
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env python
|
||||
# This file is part working_shift_contract module for Tryton.
|
||||
# This file is part stock_shipment_in_edi module for Tryton.
|
||||
# The COPYRIGHT file at the top level of this repository contains
|
||||
# the full copyright notices and license terms.
|
||||
|
||||
|
|
|
@ -100,7 +100,6 @@ class ShipmentIn(EdifactMixin, metaclass=PoolMeta):
|
|||
# means the file readed it's not a order response.
|
||||
if not message.get_segment('DESADV_D_96A_UN_EAN005'):
|
||||
return DO_NOTHING, NO_ERRORS
|
||||
|
||||
rff = message.get_segment('RFF')
|
||||
template_rff = template_header.get('RFF')
|
||||
purchase, errors = cls._process_RFF(rff, template_rff, control_chars)
|
||||
|
@ -145,7 +144,6 @@ class ShipmentIn(EdifactMixin, metaclass=PoolMeta):
|
|||
segments_iterator = RewindIterator(cps_group)
|
||||
linegroups = [x for x in separate_section(segments_iterator,
|
||||
start='LIN')]
|
||||
found_cps_level = False
|
||||
for linegroup in linegroups:
|
||||
values = {}
|
||||
for segment in linegroup:
|
||||
|
@ -170,9 +168,8 @@ class ShipmentIn(EdifactMixin, metaclass=PoolMeta):
|
|||
quantity = values.get('quantity')
|
||||
matching_moves = None
|
||||
if product:
|
||||
found_cps_level = True
|
||||
matching_moves = [m for m in shipment.pending_moves if
|
||||
m.product == product and m.pending_quantity > 0]
|
||||
(m.product == product) and (m.pending_quantity > 0)]
|
||||
if matching_moves:
|
||||
move = matching_moves[0]
|
||||
else:
|
||||
|
@ -207,8 +204,6 @@ class ShipmentIn(EdifactMixin, metaclass=PoolMeta):
|
|||
move.lot = lot
|
||||
to_save.append(move)
|
||||
|
||||
if found_cps_level:
|
||||
break
|
||||
if to_save:
|
||||
Move.save(to_save)
|
||||
return shipment, total_errors
|
||||
|
|
Loading…
Reference in New Issue