Browse Source

[FIX] Ajusta os namespaces para envio de NFe no estado do PR

A biblioteca ZEEP remove namespaces duplicadas. O estado do PR exige a mesma namespace em duas tags, devemos adicionar a mesma na tag NFe antes do envio ao sefaz Paraná.
pull/173/head
Danimar Ribeiro 7 years ago
parent
commit
59457090e9
  1. 5
      pytrustnfe/nfe/__init__.py

5
pytrustnfe/nfe/__init__.py

@ -135,6 +135,11 @@ def _send(certificado, method, **kwargs):
port = next(iter(client.wsdl.port_types)) port = next(iter(client.wsdl.port_types))
first_operation = [x for x in iter( first_operation = [x for x in iter(
client.wsdl.port_types[port].operations) if "Zip" not in x][0] client.wsdl.port_types[port].operations) if "Zip" not in x][0]
namespaceNFe = xml.find(".//{http://www.portalfiscal.inf.br/nfe}NFe")
if namespaceNFe is not None:
namespaceNFe.set('xmlns', 'http://www.portalfiscal.inf.br/nfe')
with client.settings(raw_response=True): with client.settings(raw_response=True):
response = client.service[first_operation](xml) response = client.service[first_operation](xml)
response, obj = sanitize_response(response.text) response, obj = sanitize_response(response.text)

Loading…
Cancel
Save