diff --git a/pynfe/processamento/serializacao.py b/pynfe/processamento/serializacao.py index 451d08d..a9deb9f 100644 --- a/pynfe/processamento/serializacao.py +++ b/pynfe/processamento/serializacao.py @@ -642,8 +642,12 @@ class SerializacaoXML(Serializacao): return raiz def serializar_evento(self, evento, tag_raiz='evento', retorna_string=False): - tz = datetime.utcnow().replace(tzinfo=pytz.utc).strftime('%z') + if not evento.data_emissao.strftime('%z'): + tz = datetime.utcnow().replace(tzinfo=pytz.utc).strftime('%z') + else: + tz = evento.data_emissao.strftime('%z') tz = "{}:{}".format(tz[:-2], tz[-2:]) + raiz = etree.Element(tag_raiz, versao='1.00', xmlns=NAMESPACE_NFE) e = etree.SubElement(raiz, 'infEvento', Id=evento.identificador) etree.SubElement(e, 'cOrgao').text = CODIGOS_ESTADOS[evento.uf.upper()]