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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
6 additions and
3 deletions
-
pynfe/entidades/notafiscal.py
-
pynfe/processamento/serializacao.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), |
|
|
|
|
|
|
|
@ -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 |
|
|
|
|