mirror of
https://gitlab.com/datalifeit/trytond-stock_shipment_in_edi
synced 2023-12-14 06:42:59 +01:00
Use isinstance() to check if origin points to a purchase.
If origin only points to a model without a specific ID, then 'origin' evaluates to True but is not an object (but str) so using origin.__name__ crashes.
This commit is contained in:
parent
0224697827
commit
f98cf7464d
|
@ -303,6 +303,7 @@ class EdiShipmentInLine(ModelSQL, ModelView):
|
||||||
pool = Pool()
|
pool = Pool()
|
||||||
Barcode = pool.get('product.code')
|
Barcode = pool.get('product.code')
|
||||||
REF = pool.get('edi.shipment.in.reference')
|
REF = pool.get('edi.shipment.in.reference')
|
||||||
|
Purchase = pool.get('purchase.purchase')
|
||||||
|
|
||||||
domain = [('number', '=', self.code)]
|
domain = [('number', '=', self.code)]
|
||||||
barcode = Barcode.search(domain, limit=1)
|
barcode = Barcode.search(domain, limit=1)
|
||||||
|
@ -312,8 +313,7 @@ class EdiShipmentInLine(ModelSQL, ModelView):
|
||||||
self.product = product
|
self.product = product
|
||||||
|
|
||||||
purchases = [x.origin for x in edi_shipment.references if
|
purchases = [x.origin for x in edi_shipment.references if
|
||||||
x.type_ == 'ON' and x.origin
|
x.type_ == 'ON' and isinstance(x.origin, Purchase)]
|
||||||
and x.origin.__name__ == 'purchase.purchase']
|
|
||||||
|
|
||||||
self.references = []
|
self.references = []
|
||||||
for purchase in purchases:
|
for purchase in purchases:
|
||||||
|
|
Loading…
Reference in a new issue