diff --git a/pytrustnfe/nfe/__init__.py b/pytrustnfe/nfe/__init__.py index a5da300..ebe3f60 100644 --- a/pytrustnfe/nfe/__init__.py +++ b/pytrustnfe/nfe/__init__.py @@ -89,9 +89,7 @@ def _add_qrCode(xml, **kwargs): valor_total = inf_nfe['total']['vNF'] dest_cpf = 'Inexistente' dest = nfe.find(".//{http://www.portalfiscal.inf.br/nfe}dest") - if dest: - dest_parent = dest.getparent() - dest_parent.remove(dest) + if inf_nfe.get('dest', False): if inf_nfe['dest'].get('CPF', False): dest_cpf = inf_nfe['dest']['CPF'] @@ -99,7 +97,7 @@ def _add_qrCode(xml, **kwargs): cpf = etree.Element('CPF') cpf.text = dest_cpf dest.append(cpf) - dest_parent.append(dest) + icms_total = inf_nfe['total']['vICMS'] dig_val = binascii.hexlify(xml.find( ".//{http://www.w3.org/2000/09/xmldsig#}DigestValue").text.encode()).decode() diff --git a/pytrustnfe/nfe/templates/NfeAutorizacao.xml b/pytrustnfe/nfe/templates/NfeAutorizacao.xml index b135806..d2d82e4 100644 --- a/pytrustnfe/nfe/templates/NfeAutorizacao.xml +++ b/pytrustnfe/nfe/templates/NfeAutorizacao.xml @@ -491,7 +491,6 @@ {% endif %} - {% endif %} {% if imposto.II is defined %} {{ imposto.II.vBC }} @@ -500,6 +499,7 @@ {{ imposto.II.vIOF }} {% endif %} + {% endif %} {% if imposto.PIS.CST in ('01', '02') %}