Skip to content

Commit a289675

Browse files
committed
Testes com NF-e referenciada
1 parent 4bdd35e commit a289675

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

pynfe/processamento/serializacao.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -425,10 +425,14 @@ def _serializar_nota_fiscal(self, nota_fiscal, tag_raiz='infNFe', retorna_string
425425
etree.SubElement(ide, 'indPres').text = str(nota_fiscal.indicador_presencial)
426426
etree.SubElement(ide, 'procEmi').text = str(nota_fiscal.processo_emissao)
427427
etree.SubElement(ide, 'verProc').text = '%s %s'%(self._nome_aplicacao, nota_fiscal.versao_processo_emissao)
428+
428429
### NF-e referenciada (utilizado em casos de devolução/garantia) ###
429-
# if nota_fiscal.notas_fiscais_referenciadas != None:
430-
# nfref = etree.SubElement(ide, 'NFref')
431-
# etree.SubElement(nfref, 'refNFe').text = nota_fiscal.notas_fiscais_referenciadas[0].chave_acesso
430+
# Apenas NF-e
431+
if nota_fiscal.modelo == 55:
432+
if nota_fiscal.notas_fiscais_referenciadas:
433+
nfref = etree.SubElement(ide, 'NFref')
434+
for refNFe in nota_fiscal.notas_fiscais_referenciadas:
435+
etree.SubElement(nfref, 'refNFe').text = refNFe.chave_acesso
432436

433437
### CONTINGENCIA ###
434438
if self._contingencia != None:

0 commit comments

Comments
 (0)