From 90e98191da94ab38e96b94749e93e22af4db17b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fl=C3=A1vyo=20Henrique?= Date: Wed, 22 May 2019 13:53:18 -0300 Subject: [PATCH 1/6] =?UTF-8?q?Corre=C3=A7=C3=A3o=20URL=20estado=20de=20Go?= =?UTF-8?q?i=C3=A1s.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A Sefaz GO agora usa https e não http. Adicionado o parâmetro URL necessário para emissão da NFC-e --- pynfe/utils/webservices.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pynfe/utils/webservices.py b/pynfe/utils/webservices.py index bf08aeb..c120805 100644 --- a/pynfe/utils/webservices.py +++ b/pynfe/utils/webservices.py @@ -263,8 +263,9 @@ NFCE = { 'EVENTOS': 'sefaz.go.gov.br/nfe/services/NFeRecepcaoEvento4?wsdl', 'QR': 'sefaz.go.gov.br/nfeweb/sites/nfce/danfeNFCe?', 'CADASTRO': 'sefaz.go.gov.br/nfe/services/CadConsultaCadastro4?wsdl', - 'HTTPS': 'http://nfe.', - 'HOMOLOGACAO': 'http://homolog.' + 'HTTPS': 'https://nfe.', + 'HOMOLOGACAO': 'https://homolog.', + 'URL': 'sefaz.go.gov.br/nfeweb/sites/nfce/danfeNFCe' }, 'DF': { 'QR': 'http://www.fazenda.df.gov.br/nfce/qrcode?', From 274235231e28c8c46c53692e6eb79fc652a75e4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fl=C3=A1vyo=20Henrique?= Date: Wed, 22 May 2019 13:57:58 -0300 Subject: [PATCH 2/6] =?UTF-8?q?Corre=C3=A7=C3=A3o=20para=20emiss=C3=A3o=20?= =?UTF-8?q?estado=20de=20GO?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit O retorno do estado de GO vem com a tag header, com isso, ao tentar ler o status do lote não dava certo pois tentava realizar a leitura em um indice que não existe. --- pynfe/processamento/comunicacao.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pynfe/processamento/comunicacao.py b/pynfe/processamento/comunicacao.py index 0cfdeb2..5b915ea 100644 --- a/pynfe/processamento/comunicacao.py +++ b/pynfe/processamento/comunicacao.py @@ -82,7 +82,12 @@ class ComunicacaoSefaz(Comunicacao): if ind_sinc == 1: try: # Protocolo com envio OK - inf_prot = prot[0][0] # root protNFe + try: + inf_prot = prot[0][0] # root protNFe + except IndexError: + # Estados como GO vem com a tag header + inf_prot = prot[1][0] + lote_status = inf_prot.xpath("ns:retEnviNFe/ns:cStat", namespaces=ns)[0].text # Lote processado if lote_status == '104': From ce85d97e5d32bc3709588ea4dda85e8d4b1c6338 Mon Sep 17 00:00:00 2001 From: juniortada Date: Mon, 3 Jun 2019 09:02:52 -0300 Subject: [PATCH 3/6] NT 2018/003 Responsavel tecnico --- pynfe/entidades/notafiscal.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/pynfe/entidades/notafiscal.py b/pynfe/entidades/notafiscal.py index c2fc6ac..3c994c0 100644 --- a/pynfe/entidades/notafiscal.py +++ b/pynfe/entidades/notafiscal.py @@ -355,6 +355,7 @@ class NotaFiscal(Entidade): self.duplicatas = [] self.observacoes_contribuinte = [] self.processos_referenciados = [] + self.responsavel_tecnico = [] super(NotaFiscal, self).__init__(*args, **kwargs) @@ -417,11 +418,17 @@ class NotaFiscal(Entidade): return obj def adicionar_processo_referenciado(self, **kwargs): - u"""Adiciona uma instancia de Processo Referenciado""" + """Adiciona uma instancia de Processo Referenciado""" obj = NotaFiscalProcessoReferenciado(**kwargs) self.processos_referenciados.append(obj) return obj + def adicionar_responsavel_tecnico(self, **kwargs): + """ Adiciona uma instancia de Responsavel Tecnico """ + obj = NotaFiscalResponsavelTecnico(**kwargs) + self.responsavel_tecnico.append(obj) + return obj + def _codigo_numerico_aleatorio(self): self.codigo_numerico_aleatorio = str(random.randint(0, 99999999)).zfill(8) return self.codigo_numerico_aleatorio @@ -1003,3 +1010,11 @@ class NotaFiscalServico(Entidade): def __str__(self): return ' '.join([str(self.identificador)]) + +class NotaFiscalResponsavelTecnico(Entidade): + # NT 2018/003 + cnpj = str() + contato = str() + email = str() + fone = str() + csrt = str() From e10381968f886ff029927f5f09c43316dddafe8f Mon Sep 17 00:00:00 2001 From: juniortada Date: Mon, 3 Jun 2019 09:23:00 -0300 Subject: [PATCH 4/6] =?UTF-8?q?serializa=C3=A7=C3=A3o=20xml=20respons?= =?UTF-8?q?=C3=A1vel=20tecnico=20NT2018/003?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pynfe/processamento/serializacao.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/pynfe/processamento/serializacao.py b/pynfe/processamento/serializacao.py index 077bbb2..9f623ad 100644 --- a/pynfe/processamento/serializacao.py +++ b/pynfe/processamento/serializacao.py @@ -410,6 +410,18 @@ class SerializacaoXML(Serializacao): else: return raiz + def _serializar_responsavel_tecnico(self, responsavel_tecnico, tag_raiz='infRespTec', retorna_string=True): + raiz = etree.Element(tag_raiz) + etree.SubElement(raiz, 'CNPJ').text = responsavel_tecnico.cnpj + etree.SubElement(raiz, 'xContato').text = responsavel_tecnico.contato + etree.SubElement(raiz, 'email').text = responsavel_tecnico.email + etree.SubElement(raiz, 'fone').text = responsavel_tecnico.fone + + if retorna_string: + return etree.tostring(raiz, encoding="unicode", pretty_print=True) + else: + return raiz + def _serializar_nota_fiscal(self, nota_fiscal, tag_raiz='infNFe', retorna_string=True): raiz = etree.Element(tag_raiz, versao=self._versao) @@ -636,6 +648,13 @@ class SerializacaoXML(Serializacao): if nota_fiscal.informacoes_complementares_interesse_contribuinte: etree.SubElement(info_ad, 'infCpl').text = nota_fiscal.informacoes_complementares_interesse_contribuinte + # Responsavel Tecnico NT2018/003 + if nota_fiscal.responsavel_tecnico: + for resp_tec in nota_fiscal.responsavel_tecnico: + raiz.append(self._serializar_responsavel_tecnico(resp_tec, returna_string=False)) + return + + if retorna_string: return etree.tostring(raiz, encoding="unicode", pretty_print=True) else: From 7411d225e0d3f05127efb64c0de4d21c834ddda2 Mon Sep 17 00:00:00 2001 From: juniortada Date: Mon, 3 Jun 2019 09:25:38 -0300 Subject: [PATCH 5/6] [fix] erro retorna_string --- pynfe/processamento/serializacao.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pynfe/processamento/serializacao.py b/pynfe/processamento/serializacao.py index 9f623ad..e43decc 100644 --- a/pynfe/processamento/serializacao.py +++ b/pynfe/processamento/serializacao.py @@ -651,7 +651,7 @@ class SerializacaoXML(Serializacao): # Responsavel Tecnico NT2018/003 if nota_fiscal.responsavel_tecnico: for resp_tec in nota_fiscal.responsavel_tecnico: - raiz.append(self._serializar_responsavel_tecnico(resp_tec, returna_string=False)) + raiz.append(self._serializar_responsavel_tecnico(resp_tec, retorna_string=False)) return From 5b42dea7b04df5b64b9f9c75fb0aa2eb52897ccc Mon Sep 17 00:00:00 2001 From: juniortada Date: Mon, 3 Jun 2019 09:40:44 -0300 Subject: [PATCH 6/6] [fix] add um responsavel quando existir (uf am, ms, pe, pr, sc e to) --- pynfe/processamento/serializacao.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pynfe/processamento/serializacao.py b/pynfe/processamento/serializacao.py index e43decc..c6e56e9 100644 --- a/pynfe/processamento/serializacao.py +++ b/pynfe/processamento/serializacao.py @@ -650,9 +650,8 @@ class SerializacaoXML(Serializacao): # Responsavel Tecnico NT2018/003 if nota_fiscal.responsavel_tecnico: - for resp_tec in nota_fiscal.responsavel_tecnico: - raiz.append(self._serializar_responsavel_tecnico(resp_tec, retorna_string=False)) - return + raiz.append(self._serializar_responsavel_tecnico( + nota_fiscal.responsavel_tecnico[0], retorna_string=False)) if retorna_string: