Browse Source

[FIX] Ajuste de cancelamento NFSe BH

pull/204/head
Danimar Ribeiro 7 years ago
parent
commit
95ae7157b3
  1. 6
      pytrustnfe/nfse/bh/__init__.py
  2. 4
      pytrustnfe/nfse/bh/templates/CancelarNfse.xml
  3. 2
      setup.py

6
pytrustnfe/nfse/bh/__init__.py

@ -17,15 +17,17 @@ def _render(certificado, method, **kwargs):
xml_send = render_xml(path, '%s.xml' % method, True, **kwargs) xml_send = render_xml(path, '%s.xml' % method, True, **kwargs)
reference = '' reference = ''
ref_lote = ''
if method == 'GerarNfse': if method == 'GerarNfse':
reference = 'rps:%s' % kwargs['rps']['numero'] reference = 'rps:%s' % kwargs['rps']['numero']
ref_lote = 'lote%s' % kwargs['rps']['numero_lote'] ref_lote = 'lote%s' % kwargs['rps']['numero_lote']
elif method == 'CancelarNfse': elif method == 'CancelarNfse':
reference = 'Cancelamento_NF%s' % kwargs['cancelamento']['numero_nfse']
reference = 'pedidoCancelamento_%s' % kwargs['cancelamento']['numero_nfse']
signer = Assinatura(certificado.pfx, certificado.password) signer = Assinatura(certificado.pfx, certificado.password)
xml_send = signer.assina_xml(xml_send, reference) xml_send = signer.assina_xml(xml_send, reference)
xml_send = signer.assina_xml(etree.fromstring(xml_send), ref_lote)
if ref_lote:
xml_send = signer.assina_xml(etree.fromstring(xml_send), ref_lote)
return xml_send.encode('utf-8') return xml_send.encode('utf-8')

4
pytrustnfe/nfse/bh/templates/CancelarNfse.xml

@ -1,4 +1,4 @@
<CancelarNfseEnvio xmlns="http://www.abrasf.org.br/ABRASF/arquivos/nfse.xsd">
<CancelarNfseEnvio xmlns="http://www.abrasf.org.br/nfse.xsd">
<Pedido xmlns="http://www.abrasf.org.br/nfse.xsd"> <Pedido xmlns="http://www.abrasf.org.br/nfse.xsd">
<InfPedidoCancelamento Id="pedidoCancelamento_{{ cancelamento.numero_nfse }}"> <InfPedidoCancelamento Id="pedidoCancelamento_{{ cancelamento.numero_nfse }}">
<IdentificacaoNfse> <IdentificacaoNfse>
@ -7,7 +7,7 @@
<InscricaoMunicipal>{{ cancelamento.inscricao_municipal }}</InscricaoMunicipal> <InscricaoMunicipal>{{ cancelamento.inscricao_municipal }}</InscricaoMunicipal>
<CodigoMunicipio>{{ cancelamento.cidade }}</CodigoMunicipio> <CodigoMunicipio>{{ cancelamento.cidade }}</CodigoMunicipio>
</IdentificacaoNfse> </IdentificacaoNfse>
<CodigoCancelamento>1</CodigoCancelamento>
<CodigoCancelamento>2</CodigoCancelamento>
</InfPedidoCancelamento> </InfPedidoCancelamento>
</Pedido> </Pedido>
</CancelarNfseEnvio> </CancelarNfseEnvio>

2
setup.py

@ -2,7 +2,7 @@
from setuptools import setup, find_packages from setuptools import setup, find_packages
VERSION = "1.0.27"
VERSION = "1.0.28"
setup( setup(

Loading…
Cancel
Save