From a81d64d2816404c2de501b331ea1f646a89f2cac Mon Sep 17 00:00:00 2001 From: Leonardo Gregianin Date: Sun, 16 Feb 2020 22:44:52 +0000 Subject: [PATCH 1/5] =?UTF-8?q?Corre=C3=A7=C3=A3o=20para=20emiss=C3=A3o=20?= =?UTF-8?q?de=20NFe=20com=20emitente=20CPF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pynfe/entidades/notafiscal.py | 4 ++-- pynfe/processamento/serializacao.py | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pynfe/entidades/notafiscal.py b/pynfe/entidades/notafiscal.py index ed001bf..82ad525 100644 --- a/pynfe/entidades/notafiscal.py +++ b/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), diff --git a/pynfe/processamento/serializacao.py b/pynfe/processamento/serializacao.py index 559a691..34fab45 100644 --- a/pynfe/processamento/serializacao.py +++ b/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 From 91535998c4437ba9ce5a343ffcd0b5a6f9f71103 Mon Sep 17 00:00:00 2001 From: Leonardo Date: Mon, 17 Feb 2020 16:22:23 -0300 Subject: [PATCH 2/5] =?UTF-8?q?Remove=20informa=C3=A7=C3=A3o=20antiga=20do?= =?UTF-8?q?=20readme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 7 ------- 1 file changed, 7 deletions(-) diff --git a/README.md b/README.md index b8ee260..bacf3cf 100644 --- a/README.md +++ b/README.md @@ -90,10 +90,3 @@ Documentação ----------- - https://github.com/leotada/PyNFe/wiki - http://pynfe.readthedocs.org/pt/latest/ - - -Backlog -------- -- renomeado metodo serializar_evento (_serializar_evento) -- removido metoco con.cancelar (utilizar con.evento) -- add evento carta de correção (con.evento) From 2bb7ebddfbbf8d147fbf91fd0314f5316fc4f7fd Mon Sep 17 00:00:00 2001 From: leogregianin Date: Tue, 18 Feb 2020 07:48:15 -0400 Subject: [PATCH 3/5] =?UTF-8?q?Implementa=C3=A7=C3=A3o=20do=20CST=2051=20p?= =?UTF-8?q?ara=20NFes=20do=20regime=20normal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pynfe/processamento/serializacao.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pynfe/processamento/serializacao.py b/pynfe/processamento/serializacao.py index 34fab45..e32b1ab 100644 --- a/pynfe/processamento/serializacao.py +++ b/pynfe/processamento/serializacao.py @@ -293,6 +293,11 @@ class SerializacaoXML(Serializacao): icms_item = etree.SubElement(icms, 'ICMSSN'+produto_servico.icms_modalidade) etree.SubElement(icms_item, 'orig').text = str(produto_servico.icms_origem) etree.SubElement(icms_item, 'CSOSN').text = produto_servico.icms_csosn + elif produto_servico.icms_modalidade == '51': + icms_item = etree.SubElement(icms, 'ICMS'+produto_servico.icms_modalidade) + etree.SubElement(icms_item, 'orig').text = str(produto_servico.icms_origem) + etree.SubElement(icms_item, 'CST').text = '51' + etree.SubElement(icms_item, 'modBC').text = str(produto_servico.icms_modalidade_determinacao_bc) else: ### OUTROS TIPOS DE ICMS (00,10,20) icms_item = etree.SubElement(icms, 'ICMS'+produto_servico.icms_modalidade) From 7841f0cc3e047e1f6790aa281f9d8524f8f1ad13 Mon Sep 17 00:00:00 2001 From: leogregianin Date: Tue, 18 Feb 2020 07:49:22 -0400 Subject: [PATCH 4/5] =?UTF-8?q?Implementa=C3=A7=C3=A3o=20do=20grupo=20de?= =?UTF-8?q?=20informa=C3=A7=C3=B5es=20de=20IPI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pynfe/processamento/serializacao.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/pynfe/processamento/serializacao.py b/pynfe/processamento/serializacao.py index e32b1ab..0b0c0c8 100644 --- a/pynfe/processamento/serializacao.py +++ b/pynfe/processamento/serializacao.py @@ -340,12 +340,18 @@ class SerializacaoXML(Serializacao): else: raise NotImplementedError # ipi - # ipi = etree.SubElement(imposto, 'IPI') - # etree.SubElement(ipi, 'clEnq') = produto_servico.ipi_classe_enquadramento # Preenchimento conforme Atos Normativos editados pela Receita Federal (Observação 2) - # ipint = etree.SubElement(ipi, 'IPINT') - # # 01=Entrada tributada com alíquota zero 02=Entrada isenta 03=Entrada não-tributada 04=Entrada imune 05=Entrada com suspensão - # # 51=Saída tributada com alíquota zero 52=Saída isenta 53=Saída não-tributada 54=Saída imune 55=Saída com suspensão - # etree.SubElement(ipint, 'CST') = produto_servico.ipi_codigo_enquadramento + ipint_lista = ('01','02','03','04','05','51','52','53','54','55') + if produto_servico.ipi_codigo_enquadramento in ipint_lista: + ipi = etree.SubElement(imposto, 'IPI') + # Preenchimento conforme Atos Normativos editados pela Receita Federal (Observação 2) + etree.SubElement(ipi, 'cEnq').text = produto_servico.ipi_classe_enquadramento + if produto_servico.ipi_classe_enquadramento == '': + etree.SubElement(ipi, 'cEnq').text = '999' + + ipint = etree.SubElement(ipi, 'IPINT') + # 01=Entrada tributada com alíquota zero 02=Entrada isenta 03=Entrada não-tributada 04=Entrada imune 05=Entrada com suspensão + # 51=Saída tributada com alíquota zero 52=Saída isenta 53=Saída não-tributada 54=Saída imune 55=Saída com suspensão + etree.SubElement(ipint, 'CST').text = produto_servico.ipi_codigo_enquadramento # apenas nfe if modelo == 55: From 02444339ab2ef1063eee90eca69e1b36afe9021a Mon Sep 17 00:00:00 2001 From: leogregianin Date: Thu, 20 Feb 2020 07:32:20 -0400 Subject: [PATCH 5/5] =?UTF-8?q?[fix]=20Corre=C3=A7=C3=A3o=20do=20envio=20d?= =?UTF-8?q?e=20Eventos=20com=20emitentes=20CPF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pynfe/processamento/serializacao.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pynfe/processamento/serializacao.py b/pynfe/processamento/serializacao.py index 0b0c0c8..c571654 100644 --- a/pynfe/processamento/serializacao.py +++ b/pynfe/processamento/serializacao.py @@ -687,8 +687,10 @@ class SerializacaoXML(Serializacao): e = etree.SubElement(raiz, 'infEvento', Id=evento.identificador) etree.SubElement(e, 'cOrgao').text = CODIGOS_ESTADOS[evento.uf.upper()] etree.SubElement(e, 'tpAmb').text = str(self._ambiente) - etree.SubElement(e, 'CNPJ').text = evento.cnpj # Empresas somente terão CNPJ - #etree.SubElement(e, 'CPF').text = '' + if len(so_numeros(evento.cnpj)) == 11: + etree.SubElement(e, 'CPF').text = evento.cnpj + else: + etree.SubElement(e, 'CNPJ').text = evento.cnpj etree.SubElement(e, 'chNFe').text = evento.chave etree.SubElement(e, 'dhEvento').text = evento.data_emissao.strftime('%Y-%m-%dT%H:%M:%S') + tz etree.SubElement(e, 'tpEvento').text = evento.tp_evento