def validate_codes(self):
        """Look through line items making sure that origin and destination codes are set
            set defaults if they exist, raise exception if we are missing something"""
        for l in self.Lines:
            if not hasattr(l, 'OriginCode'):
                if not hasattr(self, 'from_address_code'):
                    raise AvalaraValidationException(AvalaraException.CODE_BAD_ORIGIN, 'Origin Code needed for Line Item %r' % l.LineNo)
                l.OriginCode = self.from_address_code
                Document.logger.debug('%s setting origin code %s' % (getattr(self, 'DocCode', None), l.OriginCode))
            if not hasattr(l, 'DestinationCode'):
                if not hasattr(self, 'to_address_code'):
                    raise AvalaraValidationException(AvalaraException.CODE_BAD_DEST, 'DestinationCode needed for Line Item %r' % l.LineNo)
                l.DestinationCode = self.to_address_code
                Document.logger.debug('%s setting destination code %s' % (getattr(self, 'DocCode', None), l.DestinationCode))
dataset/ETHPy150Open activefrequency/pyavatax/pyavatax/base.py/Document.validate_codes/original