Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[18.0][MIG] mail_tracking: Migration to 18.0 #1476

Draft
wants to merge 106 commits into
base: 18.0
Choose a base branch
from

Conversation

trisdoan
Copy link

@trisdoan trisdoan commented Oct 17, 2024

Note

Big changes in 18.0

Backend

  • access_rights_uid was removed from _search() changed in odoo/odoo@21d023e
  • _prepare_outgoing_list got extra param mail_server in odoo/odoo@97ce084
  • _message_format was converted to use store and message_format_extras was removed in odoo/odoo@52df49e. As consequences, _extras_to_store is introduced
  • tools.ustr is considered to be inefficient and flagged as deprecated in odoo/odoo@64a5724. Hence, is replaced by exception_to_unicode for the same effect.

Frontend

This changes

  • Store helper was introduced in odoo/odoo@c032ccf. As consequences, failed data is now passed through Store.

    • As a side effect, it is also easier to do the search filter_failed(thread) with Store service
  • As Odoo uses less Jquery, the module runs fine with vanilla. This impacts mail_tracking/static/src/components/message_tracking/message_tracking.esm.js

  • Took this chance to

    • replace % format with f-string

    • Improve permission constraint

      • Context: This commit porting from 12.0
      • Approach is summarized as below:
        1. When do the searching,
          - First, use the query to get result
          - Browse those id with the query + Remove any forbidden records
          - Return the accessible records in form of query, to continue the process
        2. When user read the records
          - The low-level method _check_access will discard forbidden records + raise exception
      • Added security check test
    • Resolve FIXME, which was added in 7560443, then was resolved in odoo/odoo@7fe02c9

Result

discuss_sidebar

failed_search_panel

failed_message_review

antespi and others added 30 commits October 10, 2024 10:06
* [ADD] mail_tracking addon

* Add description icon

* Fixes remarked

* Fix Travis error

* Remarks fixed
…ent events (OCA#82)

[IMP] mail_tracking: Speed installation time, discard concurrent events and other fixes
* Improve tests
* Show trackings even if partner removed
* Disable CSRF protection to webhooks controllers
As regular users can't access this object.
* [FIX] Only one data-odoo-tracking-email tag in each email
* [FIX] Get status even in multicompany instances
On our server,
queries based on "mail_tracking_event"."tracking_email_id" improved from 501,924 ms to 1,840 ms
queries based on "mail_tracking_email"."mail_message_id" improved from 167,436 ms to 3,223 ms

The last ones are run several times when a thread has many messages
Currently translated at 100.0% (82 of 82 strings)

Translation: social-11.0/social-11.0-mail_tracking
Translate-URL: https://translation.odoo-community.org/projects/social-11-0/social-11-0-mail_tracking/fr/
For giving more priority to other buttons like the invoices one.
Currently translated at 96.3% (79 of 82 strings)

Translation: social-11.0/social-11.0-mail_tracking
Translate-URL: https://translation.odoo-community.org/projects/social-11-0/social-11-0-mail_tracking/ca/
Or infinite recursions will happen on other `write` overwrites, like the one that happens
on `mass_mailing_partner`.
mymage and others added 16 commits October 10, 2024 10:06
Currently translated at 29.8% (34 of 114 strings)

Translation: social-15.0/social-15.0-mail_tracking
Translate-URL: https://translation.odoo-community.org/projects/social-15-0/social-15-0-mail_tracking/it/
Currently translated at 100.0% (125 of 125 strings)

Translation: social-16.0/social-16.0-mail_tracking
Translate-URL: https://translation.odoo-community.org/projects/social-16-0/social-16-0-mail_tracking/fr/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: social-17.0/social-17.0-mail_tracking
Translate-URL: https://translation.odoo-community.org/projects/social-17-0/social-17-0-mail_tracking/
Currently translated at 100.0% (128 of 128 strings)

Translation: social-17.0/social-17.0-mail_tracking
Translate-URL: https://translation.odoo-community.org/projects/social-17-0/social-17-0-mail_tracking/it/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: social-17.0/social-17.0-mail_tracking
Translate-URL: https://translation.odoo-community.org/projects/social-17-0/social-17-0-mail_tracking/
Add autovacuum to mail_tracking_email that removes old records based on new configuration variable mail_tracking_email_max_age_days.
Due to possibly a large number of records to be deleted on first run, set a default limit of 5000 per run.
@trisdoan trisdoan mentioned this pull request Oct 17, 2024
21 tasks
@trisdoan trisdoan marked this pull request as draft October 17, 2024 05:09
@trisdoan
Copy link
Author

trisdoan commented Oct 17, 2024

DRAFT: working on failed test

> 2024-10-17 05:08:43,628 246 WARNING odoo odoo.addons.mail_tracking.controllers.main: MailTracking email '11' not found

@pedrobaeza
Copy link
Member

/ocabot migration mail_tracking

@OCA-git-bot OCA-git-bot added this to the 18.0 milestone Oct 17, 2024
Copy link
Member

@chienandalu chienandalu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huge work @trisdoan !

I should try with a real mail configuration. For the moment:

Installing the module in runboat doesn't load for me the demo failed messages for retry (I saw in them in your screenshot thou...)

image

@@ -29,7 +30,7 @@ class MailMessage(models.Model):
)
is_failed_message = fields.Boolean(
compute="_compute_is_failed_message",
search="_search_is_failed_message",
store=True,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need to make it stored?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, this flag is used to populate the controller: /mail/failed/messages

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't change how it was, no stored and with search method. Or does any reason for changing it?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @pedrobaeza, yes I agree there is no need to store it in db. But look like the search method is not working.

I am working on it, will update when it's done

@trisdoan trisdoan marked this pull request as draft October 21, 2024 04:29
@trisdoan
Copy link
Author

DRAFT: inspect _search_is_failed_message

@pedrobaeza
Copy link
Member

What do you think about #1458 (comment) ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.