Browse Source

Merge pull request #74 from leogregianin/master

Correção para emissão de NFe com emitente CPF
pull/75/head
Leonardo 6 years ago
committed by GitHub
parent
commit
d5f6528cd0
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      pynfe/entidades/notafiscal.py
  2. 5
      pynfe/processamento/serializacao.py

4
pynfe/entidades/notafiscal.py

@ -468,7 +468,7 @@ class NotaFiscal(Entidade):
'uf': CODIGOS_ESTADOS[self.uf],
'ano': self.data_emissao.strftime('%y'),
'mes': self.data_emissao.strftime('%m'),
'cnpj': so_numeros(self.emitente.cnpj),
'cnpj': so_numeros(self.emitente.cnpj).zfill(14),
'mod': self.modelo,
'serie': str(self.serie).zfill(3),
'nNF': str(self.numero_nf).zfill(9),
@ -479,7 +479,7 @@ class NotaFiscal(Entidade):
'uf': CODIGOS_ESTADOS[self.uf],
'ano': self.data_emissao.strftime('%y'),
'mes': self.data_emissao.strftime('%m'),
'cnpj': so_numeros(self.emitente.cnpj),
'cnpj': so_numeros(self.emitente.cnpj).zfill(14),
'mod': self.modelo,
'serie': str(self.serie).zfill(3),
'nNF': str(self.numero_nf).zfill(9),

5
pynfe/processamento/serializacao.py

@ -90,7 +90,10 @@ class SerializacaoXML(Serializacao):
raiz = etree.Element(tag_raiz)
# Dados do emitente
etree.SubElement(raiz, 'CNPJ').text = so_numeros(emitente.cnpj)
if len(so_numeros(emitente.cnpj)) == 11:
etree.SubElement(raiz, 'CPF').text = so_numeros(emitente.cnpj)
else:
etree.SubElement(raiz, 'CNPJ').text = so_numeros(emitente.cnpj)
etree.SubElement(raiz, 'xNome').text = emitente.razao_social
etree.SubElement(raiz, 'xFant').text = emitente.nome_fantasia
# Endereço

Loading…
Cancel
Save