Refactor shipment field on unit load.

This commit refs #13583
This commit is contained in:
Sergio Morillo 2020-06-29 18:42:36 +02:00
parent 6564ee1f24
commit cc0627f12d
1 changed files with 3 additions and 3 deletions

View File

@ -103,10 +103,10 @@ class UnitLoad(metaclass=PoolMeta):
return ''
def get_sscc(self):
if self.shipment_out:
if self.shipment and self.shipment.__name__ == 'stock.shipment.out':
edi_codes = [identifier.code for identifier in
self.shipment_out.company.party.identifiers
if identifier.type == 'EDI_sender']
self.shipment.company.party.identifiers
if identifier.type == 'EDI_sender']
edi_code = edi_codes[0][:6] if edi_codes else '000000'
code = '00' + edi_code + self.code[-9:].zfill(len(self.code[-9:])-9)
return code + get_control_digit(code)