From c14969b31ea53934a510d9eff6051be4177c8bd0 Mon Sep 17 00:00:00 2001 From: Junior Tada Date: Mon, 5 Oct 2015 13:55:10 -0300 Subject: [PATCH] =?UTF-8?q?Melhorando=20serializa=C3=A7=C3=A3o=20para=20cl?= =?UTF-8?q?iente=20apenas=20com=20cpf/cnpj?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pynfe/processamento/serializacao.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pynfe/processamento/serializacao.py b/pynfe/processamento/serializacao.py index 48864b3..c727e21 100644 --- a/pynfe/processamento/serializacao.py +++ b/pynfe/processamento/serializacao.py @@ -125,9 +125,9 @@ class SerializacaoXML(Serializacao): # Dados do cliente (distinatario) etree.SubElement(raiz, cliente.tipo_documento).text = so_numeros(cliente.numero_documento) - if cliente.razao_social: - etree.SubElement(raiz, 'xNome').text = cliente.razao_social if not self._so_cpf: + if cliente.razao_social: + etree.SubElement(raiz, 'xNome').text = cliente.razao_social endereco = etree.SubElement(raiz, 'enderDest') etree.SubElement(endereco, 'xLgr').text = cliente.endereco_logradouro etree.SubElement(endereco, 'nro').text = cliente.endereco_numero @@ -144,12 +144,12 @@ class SerializacaoXML(Serializacao): if cliente.endereco_telefone: etree.SubElement(endereco, 'fone').text = cliente.endereco_telefone #Indicador da IE do destinatário: 1 – Contribuinte ICMSpagamento à vista; 2 – Contribuinte isento de inscrição; 9 – Não Contribuinte - if cliente.isento_icms or cliente.inscricao_estadual.upper() == 'ISENTO': - etree.SubElement(raiz, 'indIEDest').text = str(2) - etree.SubElement(raiz, 'IE').text = 'ISENTO' - elif cliente.indicador_ie == 9: + if cliente.indicador_ie == 9: # 9 – Não Contribuinte - etree.SubElement(raiz, 'indIEDest').text = str(9) + etree.SubElement(raiz, 'indIEDest').text = '9' + elif cliente.isento_icms or cliente.inscricao_estadual.upper() == 'ISENTO': + etree.SubElement(raiz, 'indIEDest').text = '2' + etree.SubElement(raiz, 'IE').text = 'ISENTO' else: # Indicador da IE do destinatário: 1 – Contribuinte ICMSpagamento à vista; etree.SubElement(raiz, 'indIEDest').text = cliente.indicador_ie