|
|
|
@ -125,7 +125,8 @@ class SerializacaoXML(Serializacao): |
|
|
|
|
|
|
|
# Dados do cliente (distinatario) |
|
|
|
etree.SubElement(raiz, cliente.tipo_documento).text = so_numeros(cliente.numero_documento) |
|
|
|
etree.SubElement(raiz, 'xNome').text = cliente.razao_social |
|
|
|
if cliente.razao_social: |
|
|
|
etree.SubElement(raiz, 'xNome').text = cliente.razao_social |
|
|
|
if not self._so_cpf: |
|
|
|
endereco = etree.SubElement(raiz, 'enderDest') |
|
|
|
etree.SubElement(endereco, 'xLgr').text = cliente.endereco_logradouro |
|
|
|
@ -142,26 +143,26 @@ class SerializacaoXML(Serializacao): |
|
|
|
etree.SubElement(endereco, 'xPais').text = obter_pais_por_codigo(cliente.endereco_pais) |
|
|
|
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: |
|
|
|
# 9 – Não Contribuinte |
|
|
|
etree.SubElement(raiz, 'indIEDest').text = str(9) |
|
|
|
else: |
|
|
|
# Indicador da IE do destinatário: 1 – Contribuinte ICMSpagamento à vista; |
|
|
|
etree.SubElement(raiz, 'indIEDest').text = cliente.indicador_ie |
|
|
|
etree.SubElement(raiz, 'IE').text = cliente.inscricao_estadual |
|
|
|
# Suframa |
|
|
|
if cliente.inscricao_suframa: |
|
|
|
etree.SubElement(raiz, 'ISUF').text = cliente.inscricao_suframa |
|
|
|
# Inscrição Municipal do tomador do serviço |
|
|
|
if cliente.inscricao_municipal: |
|
|
|
etree.SubElement(raiz, 'IM').text = cliente.inscricao_municipal |
|
|
|
# E-mail |
|
|
|
if cliente.email: |
|
|
|
etree.SubElement(raiz, 'email').text = cliente.email |
|
|
|
#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: |
|
|
|
# 9 – Não Contribuinte |
|
|
|
etree.SubElement(raiz, 'indIEDest').text = str(9) |
|
|
|
else: |
|
|
|
# Indicador da IE do destinatário: 1 – Contribuinte ICMSpagamento à vista; |
|
|
|
etree.SubElement(raiz, 'indIEDest').text = cliente.indicador_ie |
|
|
|
etree.SubElement(raiz, 'IE').text = cliente.inscricao_estadual |
|
|
|
# Suframa |
|
|
|
if cliente.inscricao_suframa: |
|
|
|
etree.SubElement(raiz, 'ISUF').text = cliente.inscricao_suframa |
|
|
|
# Inscrição Municipal do tomador do serviço |
|
|
|
if cliente.inscricao_municipal: |
|
|
|
etree.SubElement(raiz, 'IM').text = cliente.inscricao_municipal |
|
|
|
# E-mail |
|
|
|
if cliente.email: |
|
|
|
etree.SubElement(raiz, 'email').text = cliente.email |
|
|
|
if retorna_string: |
|
|
|
return etree.tostring(raiz, encoding="unicode", pretty_print=True) |
|
|
|
else: |
|
|
|
|