OCA / social

Addons concerning odoo's social ERP features and messaging in general
https://odoo-community.org/project/99
GNU Affero General Public License v3.0
160 stars 612 forks source link

[15.0] mail_tracking: Deprecation Warning on sending #952

Closed ghost closed 2 years ago

ghost commented 2 years ago

Module

Mail Tracking

Describe the bug

Prior to installing the mail_tracking addon email's sent perfectly fine. Now that it is installed mail is still sending and receiving fine but a deprecation warning is logging to odoo.log Main line is : 2022-08-23 14:18:57,180 2710 WARNING dbname py.warnings: /home/odoo/addons/mail_tracking/models/ir_mail_server.py:16: DeprecationWarning: currentThread() is deprecated, use current_thread() instead

To Reproduce

Steps to reproduce the behavior:

  1. Clone latest OCA Social Repo branch 15.0
  2. In setting activate developer mode
  3. In apps click Update Apps List
  4. In search bar remove apps and search mail_tracking
  5. Press Install
  6. Go to a customer/supplier/partner/contact record and send a message to a supplier with a valid email address
  7. View server logs.

Expected behavior Email sends and all should be well

Additional context Server: Vultr KVM based VPS Cores: 1vpcu Ram: 1024MB Storage: 25GB NVME OS: Fedora 36 Python: 3.10 Odoo: 15 community latest version pulled fresh I did have to modify the odoo requirements file for pip to bump the python-ldap library as our staff all use an IPA server for authentication.

Installed Addons

Module Name Technical Name Author Website Latest Version Status
Invoicing account Odoo S.A. https://www.odoo.com/app/invoicing 15.0.1.2 Installed
Odoo 15 Full Accounting Kit base_accounting_kit Cybrosys Techno Solutions, Odoo SA https://www.cybrosys.com 15.0.2.2.2 Installed
Discuss mail Odoo S.A. https://www.odoo.com/app/discuss 15.0.1.5 Installed
Web Responsive web_responsive LasLabs, Tecnativa, ITerra, Odoo Community Association (OCA) https://github.com/OCA/web 15.0.1.1.1 Installed
Check Printing Base account_check_printing Odoo S.A.   15.0.1.0 Installed
Import/Export Invoices From XML/PDF account_edi Odoo S.A.   15.0.1.0 Installed
Import/Export invoices with Factur-X account_edi_facturx Odoo S.A.   15.0.1.0 Installed
Import/Export electronic invoices with UBL/CII account_edi_ubl_cii Odoo S.A.   15.0.1.0 Installed
Payment - Account account_payment Odoo S.A.   15.0.1.0 Installed
account_qr_code_sepa account_qr_code_sepa Odoo S.A.   15.0.0.1 Installed
Analytic Accounting analytic Odoo S.A.   15.0.1.1 Installed
Authentication via LDAP auth_ldap Odoo S.A.   15.0.1.0 Installed
Signup auth_signup Odoo S.A.   15.0.1.0 Installed
Two-Factor Authentication (TOTP) auth_totp Odoo S.A.   15.0.1.0 Installed
2FA Invite mail auth_totp_mail Odoo S.A.   15.0.1.0 Installed
TOTPortal auth_totp_portal Odoo S.A.   15.0.1.0 Installed
Base base Odoo S.A.   15.0.1.3 Installed
Odoo 15 Budget Management base_account_budget Cybrosys Techno Solutions https://www.cybrosys.com 15.0.1.1.0 Installed
Partners Geolocation base_geolocalize Odoo S.A.   15.0.2.1 Installed
IBAN Bank Accounts base_iban Odoo S.A.   15.0.1.0 Installed
Base import base_import Odoo S.A.   15.0.2.0 Installed
Initial Setup Tools base_setup Odoo S.A.   15.0.1.0 Installed
Sparse Fields base_sparse_field Odoo S.A.   15.0.1.0 Installed
VAT Number Validation base_vat Odoo S.A.   15.0.1.0 Installed
IM Bus bus Odoo S.A.   15.0.1.0 Installed
KPI Digests digest Odoo S.A.   15.0.1.1 Installed
Dynamic Financial Reports dynamic_accounts_report Cybrosys Techno Solutions https://www.cybrosys.com 15.0.1.0.4 Installed
Email Gateway fetchmail Odoo S.A.   15.0.1.0 Installed
Fetchmail Incoming Log fetchmail_incoming_log ForgeFlow, Odoo Community Association (OCA) https://github.com/OCA/server-tools 15.0.1.0.0 Installed
Fetchmail Notify Error to Sender fetchmail_notify_error_to_sender Agile Business Group,ForgeFlow,Odoo Community Association (OCA) https://github.com/OCA/server-tools 15.0.1.0.0 Installed
In-App Purchases iap Odoo S.A.   15.0.1.1 Installed
IAP / Mail iap_mail Odoo S.A.   15.0.1.0 Installed
UK - Accounting l10n_uk SmartMode LTD https://www.odoo.com/app/accounting 15.0.1.0 Installed
OdooBot mail_bot Odoo S.A. https://www.odoo.com/app/discuss 15.0.1.2 Installed
Mail Debrand mail_debrand Tecnativa, ForgeFlow, Onestein, Sodexis, Nexterp Romania, Odoo Community Association (OCA) https://github.com/OCA/social 15.0.1.2.2 Installed
Email tracking mail_tracking Tecnativa, Odoo Community Association (OCA) https://github.com/OCA/social 15.0.1.0.1 Installed
Payment Acquirer payment Odoo S.A.   15.0.2.0 Installed
Wire Transfer Payment Acquirer payment_transfer Odoo S.A.   15.0.2.0 Installed
Remove Odoo Branding from Website portal_odoo_debranding TAKOBI, Odoo Community Association (OCA) https://github.com/OCA/server-brand 15.0.1.0.0 Installed
Products & Pricelists product Odoo S.A.   15.0.1.2 Installed
Resource resource Odoo S.A.   15.0.1.1 Installed
Sales sale Odoo S.A.   15.0.1.2 Installed
Sale - SMS sale_sms Odoo S.A.   15.0.1.0 Installed
Sales Teams sales_team Odoo S.A. https://www.odoo.com/app/crm 15.0.1.1 Installed
SMS gateway sms Odoo S.A.   15.0.2.2 Installed
Snail Mail snailmail Odoo S.A.   15.0.0.3 Installed
Test Performance test_performance Odoo S.A.   15.0.1.0 Installed
Units of measure uom Odoo S.A.   15.0.1.0 Installed
UTM Trackers utm Odoo S.A.   15.0.1.1 Installed
Web web Odoo S.A.   15.0.1.0 Installed
Web Company Color web_company_color Alexandre Díaz, Odoo Community Association (OCA) https://github.com/OCA/web 15.0.1.1.0 Installed
Drop target support web_drop_target Therp BV,Odoo Community Association (OCA) https://github.com/OCA/web 15.0.1.0.1 Installed
Web Editor web_editor Odoo S.A.   15.0.1.0 Installed
Gauge Widget for Kanban web_kanban_gauge Odoo S.A.   15.0.1.0 Installed
Web No Bubble web_no_bubble Savoir-faire Linux, Odoo Community Association (OCA) https://github.com/OCA/web 15.0.1.0.0 Installed
Web Refresher web_refresher Compassion Switzerland, Odoo Community Association (OCA) https://github.com/OCA/web 15.0.1.0.0 Installed
Tours web_tour Odoo S.A.   15.0.0.1 Installed
Customer Portal portal Odoo S.A.   15.0.1.0 Installed
Web Routing http_routing Odoo S.A.   15.0.1.0 Installed
Mail Tests test_mail Odoo S.A.   15.0.1.0 Installed
Phone Numbers Validation phone_validation Odoo S.A.   15.0.2.1 Installed

Server Logs 2022-08-23 14:18:57,180 2710 WARNING nts py.warnings: /home/odoo/addons/mail_tracking/models/ir_mail_server.py:16: DeprecationWarning: currentThread() is deprecated, use current_thread() instead File "/usr/lib64/python3.10/threading.py", line 973, in _bootstrap self._bootstrap_inner() File "/usr/lib64/python3.10/threading.py", line 1016, in _bootstrap_inner self.run() File "/usr/lib64/python3.10/threading.py", line 953, in run self._target(*self._args, **self._kwargs) File "/home/odoo/odoo/odoo/service/server.py", line 1062, in _runloop self.process_work() File "/home/odoo/odoo/odoo/service/server.py", line 1101, in process_work self.process_request(client, addr) File "/home/odoo/odoo/odoo/service/server.py", line 1092, in process_request self.server.process_request(client, addr) File "/usr/lib64/python3.10/socketserver.py", line 347, in process_request self.finish_request(request, client_address) File "/usr/lib64/python3.10/socketserver.py", line 360, in finish_request self.RequestHandlerClass(request, client_address, self) File "/usr/lib64/python3.10/socketserver.py", line 747, in __init__ self.handle() File "/home/odoo/python3.10-venv/lib64/python3.10/site-packages/werkzeug/serving.py", line 342, in handle BaseHTTPRequestHandler.handle(self) File "/usr/lib64/python3.10/http/server.py", line 432, in handle self.handle_one_request() File "/home/odoo/python3.10-venv/lib64/python3.10/site-packages/werkzeug/serving.py", line 374, in handle_one_request self.run_wsgi() File "/home/odoo/python3.10-venv/lib64/python3.10/site-packages/werkzeug/serving.py", line 319, in run_wsgi execute(self.server.app) File "/home/odoo/python3.10-venv/lib64/python3.10/site-packages/werkzeug/serving.py", line 308, in execute application_iter = app(environ, start_response) File "/home/odoo/odoo/odoo/service/wsgi_server.py", line 110, in application return ProxyFix(application_unproxied)(environ, start_response) File "/home/odoo/python3.10-venv/lib64/python3.10/site-packages/werkzeug/middleware/proxy_fix.py", line 187, in __call__ return self.app(environ, start_response) File "/home/odoo/odoo/odoo/service/wsgi_server.py", line 87, in application_unproxied result = odoo.http.root(environ, start_response) File "/home/odoo/odoo/odoo/http.py", line 1336, in __call__ return self.dispatch(environ, start_response) File "/home/odoo/odoo/odoo/http.py", line 1302, in __call__ return self.app(environ, start_wrapped) File "/home/odoo/python3.10-venv/lib64/python3.10/site-packages/werkzeug/middleware/shared_data.py", line 287, in __call__ return self.app(environ, start_response) File "/home/odoo/odoo/odoo/http.py", line 1509, in dispatch with request_manager: File "/home/odoo/odoo/odoo/http.py", line 264, in __exit__ self._cr.commit() File "<decorator-gen-7>", line 2, in commit File "/home/odoo/odoo/odoo/sql_db.py", line 90, in check return f(self, *args, **kwargs) File "/home/odoo/odoo/odoo/sql_db.py", line 475, in commit self.postcommit.run() File "/home/odoo/odoo/odoo/tools/misc.py", line 1139, in run func() File "/home/odoo/odoo/addons/mail/models/mail_thread.py", line 2346, in send_notifications env['mail.mail'].browse(email_ids).send() File "/home/odoo/odoo/addons/mail/models/mail_mail.py", line 356, in send self.browse(batch_ids)._send( File "/home/odoo/odoo/addons/mail/models/mail_mail.py", line 447, in _send msg = IrMailServer.build_email( File "/home/odoo/addons/mail_tracking/models/ir_mail_server.py", line 46, in build_email headers = self._tracking_headers_add(tracking_email_id, headers) File "/home/odoo/addons/mail_tracking/models/ir_mail_server.py", line 16, in _tracking_headers_add headers["X-Odoo-Database"] = getattr(threading.currentThread(), "dbname", None)

pedrobaeza commented 2 years ago

Can you please do the PR changing the call?

ghost commented 2 years ago

Hey @pedrobaeza , I will give it a shot shortly, just be aware I am still a Python novice.

pedrobaeza commented 2 years ago

Give it a try and tell me.

ghost commented 2 years ago

@pedrobaeza Done and tested on my production 15 install was easier then I imagined :)

pedrobaeza commented 2 years ago

Great, closing in favor of the pull request