mirror of
https://gitlab.com/datalifeit/trytond-stock_shipment_in_edi
synced 2023-12-14 06:42:59 +01:00
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
62d8faceea
commit
1a08c4e969
|
@ -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 a new issue