Update EDI import shipments. Some times the EDI reference is not the purchase number, it's the purchase reference, so we need to search for the reference too, ensuring is unique
This commit is contained in:
parent
c02e7b0ee4
commit
820c1bbc3c
|
@ -241,6 +241,13 @@ class ShipmentIn(EdifactMixin, metaclass=PoolMeta):
|
|||
('number', '=', purchase_num),
|
||||
('state', 'in', ('processing', 'done'))
|
||||
], limit=1) or [None]
|
||||
if not purchase:
|
||||
purchases = Purchase.search([
|
||||
('reference', '=', purchase_num),
|
||||
('state', 'in', ('processing', 'done'))
|
||||
])
|
||||
if len(purchases) == 1:
|
||||
purchase = purchase[0]
|
||||
if not purchase:
|
||||
error_msg = 'Purchase number {} not found'.format(purchase_num)
|
||||
serialized_segment = Serializer(control_chars).serialize([segment])
|
||||
|
|
Loading…
Reference in New Issue