danimaribeiro / PyTrustNFe

Módulo NF-e Python
GNU Affero General Public License v3.0
174 stars 140 forks source link

Odoo 15 - Erro na Assinatura do XML - Envio NFE #320

Open Lemuel-Arantes opened 1 year ago

Lemuel-Arantes commented 1 year ago

Boa noite,

Estou enfrentando o seguinte erro ao enviar uma NF-e para o ambiente de homologação da Receita Federal.

Estou usando o Odoo 15 em uma VM com Ubuntu 20.04.

Versões: pytrustnfe3==1.0.61 signxml==2.10.1 pyOpenSSL==23.0.0

RPC_ERROR Odoo Server Error Traceback (most recent call last): File "/odoo/odoo-server/odoo/addons/base/models/ir_http.py", line 237, in _dispatch result = request.dispatch() File "/odoo/odoo-server/odoo/http.py", line 687, in dispatch result = self._call_function(self.params) File "/odoo/odoo-server/odoo/http.py", line 359, in _call_function return checked_call(self.db, *args, *kwargs) File "/odoo/odoo-server/odoo/service/model.py", line 94, in wrapper return f(dbname, args, kwargs) File "/odoo/odoo-server/odoo/http.py", line 348, in checked_call result = self.endpoint(*a, kw) File "/odoo/odoo-server/odoo/http.py", line 916, in call return self.method(*args, *kw) File "/odoo/odoo-server/odoo/http.py", line 535, in response_wrap response = f(args, kw) File "/odoo/odoo-server/addons/web/controllers/main.py", line 1346, in call_button action = self._call_kw(model, method, args, kwargs) File "/odoo/odoo-server/addons/web/controllers/main.py", line 1334, in _call_kw return call_kw(request.env[model], method, args, kwargs) File "/odoo/odoo-server/odoo/api.py", line 464, in call_kw result = _call_kw_multi(method, model, args, kwargs) File "/odoo/odoo-server/odoo/api.py", line 451, in _call_kw_multi result = method(recs, *args, kwargs) File "/odoo/custom/addons/odoo-brasil/l10n_br_eletronic_document/models/nfe.py", line 801, in action_send_eletronic_invoice self.action_post_validate() File "/odoo/custom/addons/odoo-brasil/l10n_br_eletronic_document/models/nfe.py", line 776, in action_post_validate xml_enviar = xml_autorizar_nfe(certificado, lote) File "/usr/local/lib/python3.8/dist-packages/pytrustnfe/nfe/init.py", line 237, in xml_autorizar_nfe return _render(certificado, "NfeAutorizacao", True, **kwargs) File "/usr/local/lib/python3.8/dist-packages/pytrustnfe/nfe/init.py", line 56, in _render xml_send = signer.assina_xml( File "/usr/local/lib/python3.8/dist-packages/pytrustnfe/nfe/assinatura.py", line 23, in assina_xml signer = XMLSigner( File "/home/odoo/.local/lib/python3.8/site-packages/signxml/signer.py", line 114, in init self.check_deprecated_methods() File "/home/odoo/.local/lib/python3.8/site-packages/signxml/signer.py", line 123, in check_deprecated_methods raise InvalidInput(msg) Exception

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/odoo/odoo-server/odoo/http.py", line 643, in _handle_exception return super(JsonRequest, self)._handle_exception(exception) File "/odoo/odoo-server/odoo/http.py", line 301, in _handle_exception raise exception.with_traceback(None) from new_cause signxml.exceptions.InvalidInput: SHA1-based algorithms are not supported in the default configuration because they are not secure

Sei que o PyTrustNFe3 exige a versão 17.5.0 do pyOpenSSL, mas se eu instalo esta versão o servidor cai e apresenta o seguinte erro na subida do serviço do odoo 15:

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.8/dist-packages/werkzeug/serving.py", line 306, in run_wsgi execute(self.server.app) File "/usr/local/lib/python3.8/dist-packages/werkzeug/serving.py", line 294, in execute application_iter = app(environ, start_response) File "/odoo/odoo-server/odoo/service/server.py", line 482, in app return self.app(e, s) File "/odoo/odoo-server/odoo/service/wsgi_server.py", line 110, in application return ProxyFix(application_unproxied)(environ, start_response) File "/usr/local/lib/python3.8/dist-packages/werkzeug/middleware/proxy_fix.py", line 232, in call return self.app(environ, start_response) File "/odoo/odoo-server/odoo/service/wsgi_server.py", line 87, in application_unproxied result = odoo.http.root(environ, start_response) File "/odoo/odoo-server/odoo/http.py", line 1341, in call return self.dispatch(environ, start_response) File "/odoo/odoo-server/odoo/http.py", line 1307, in call return self.app(environ, start_wrapped) File "/usr/local/lib/python3.8/dist-packages/werkzeug/middleware/shared_data.py", line 220, in call return self.app(environ, start_response) File "/odoo/odoo-server/odoo/http.py", line 1518, in dispatch odoo.registry(db).check_signaling() File "/odoo/odoo-server/odoo/init.py", line 104, in registry return modules.registry.Registry(database_name) File "/odoo/odoo-server/odoo/modules/registry.py", line 63, in new return cls.new(db_name) File "/odoo/odoo-server/odoo/modules/registry.py", line 87, in new odoo.modules.load_modules(registry, force_demo, status, update_module) File "/odoo/odoo-server/odoo/modules/loading.py", line 415, in load_modules loaded_modules, processed_modules = load_module_graph( File "/odoo/odoo-server/odoo/modules/loading.py", line 179, in load_module_graph load_openerp_module(package.name) File "/odoo/odoo-server/odoo/modules/module.py", line 396, in load_openerp_module import('odoo.addons.' + module_name) File "/odoo/odoo-server/odoo/addons/base/init.py", line 5, in from . import models File "/odoo/odoo-server/odoo/addons/base/models/init.py", line 23, in from . import ir_mail_server File "/odoo/odoo-server/odoo/addons/base/models/ir_mail_server.py", line 19, in from OpenSSL import crypto as SSLCrypto File "/usr/local/lib/python3.8/dist-packages/OpenSSL/init.py", line 8, in from OpenSSL import crypto, SSL File "/usr/local/lib/python3.8/dist-packages/OpenSSL/crypto.py", line 1550, in class X509StoreFlags(object): File "/usr/local/lib/python3.8/dist-packages/OpenSSL/crypto.py", line 1570, in X509StoreFlags CB_ISSUER_CHECK = _lib.X509_V_FLAG_CB_ISSUER_CHECK AttributeError: module 'lib' has no attribute 'X509_V_FLAG_CB_ISSUER_CHECK' - - -

Executo: sudo pip3 install pyopenssl --upgrade

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. pytrustnfe3 1.0.61 requires pyOpenSSL<18,>=16.0.0, but you have pyopenssl 23.0.0 which is incompatible. Successfully installed pyopenssl-23.0.0

Reinicio o serviço do odoo-server e o servidor retorna ao ar, porém retorna o erro:

signxml.exceptions.InvalidInput: SHA1-based algorithms are not supported in the default configuration because they are not secure

Ao tentar aprovar uma NF-e junto a Receita Federal

Se alguém puder me ajudar, agradeço.

gabrieligbastos commented 1 year ago

Opa, conseguiu resolver de algum jeito?

+1