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

[17.0][MIG] mail_quoted_reply: Migration to 17.0 #1354

Open
wants to merge 36 commits into
base: 17.0
Choose a base branch
from

Conversation

trisdoan
Copy link

Major changes in V17

  • Split _onchange_template_id + default_get + get_record_data usage into editable
    computed stored fields in here
  • _evaluate_res_ids is introduced to parse composer res_ids in here. As consequence, 'default_res_id' is deprecated, should use 'default_res_ids'.

Components:

  • There is a huge refactor in efforts to use OWL in here

@trisdoan trisdoan mentioned this pull request Apr 19, 2024
30 tasks
@hbrunn
Copy link
Member

hbrunn commented Apr 22, 2024

/ocabot migration mail_quoted_reply

@OCA-git-bot OCA-git-bot added this to the 17.0 milestone Apr 22, 2024
res = super()._compute_body()
for composer in self:
context = composer._context
if "is_quoted_reply" in context.keys() and context["is_quoted_reply"]:
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if "is_quoted_reply" in context.keys() and context["is_quoted_reply"]:
if context.get("is_quoted_reply"):

result["subject"] = tools.ustr(subj)
return result
@api.depends(
"composition_mode", "model", "parent_id", "res_domain", "res_ids", "template_id"
Copy link
Member

Choose a reason for hiding this comment

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

why do you remove record_name here?

mail_quoted_reply/models/mail_message.py Outdated Show resolved Hide resolved
@trisdoan trisdoan force-pushed the 17.0-mig-mail_quoted_reply branch 4 times, most recently from dabd555 to 0efb748 Compare April 29, 2024 07:51
@trisdoan trisdoan requested a review from hbrunn April 29, 2024 07:52
@trisdoan
Copy link
Author

Hello @hbrunn, I updated as you suggest 🙏

etobella and others added 20 commits May 2, 2024 15:09
Currently translated at 100.0% (8 of 8 strings)

Translation: social-14.0/social-14.0-mail_quoted_reply
Translate-URL: https://translation.odoo-community.org/projects/social-14-0/social-14-0-mail_quoted_reply/ca/
Currently translated at 100.0% (8 of 8 strings)

Translation: social-14.0/social-14.0-mail_quoted_reply
Translate-URL: https://translation.odoo-community.org/projects/social-14-0/social-14-0-mail_quoted_reply/es/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: social-15.0/social-15.0-mail_quoted_reply
Translate-URL: https://translation.odoo-community.org/projects/social-15-0/social-15-0-mail_quoted_reply/
Borruso and others added 15 commits May 2, 2024 15:09
Completed the migration to 16.0 incl. the upgrade to the OWL framework to make it more lean and reliable for the future.
This commit adds functionality to include the original subject of a message when composing a quoted reply. The `get_record_data` method in the `MailComposeMessage` model has been updated to check if there is a default subject and, if so, prepend "Re: " to it. This ensures that the new subject for the quoted reply includes a "Re:" prefix.
_prep_quoted_reply_body. put the format date in the env format

[15][IMP]mail_quoted_reply: Added signature, and translate fields

Make it: From, Date, Subject Strings translate
Addded User Signature

Update mail_message.py

Update CONTRIBUTORS.rst
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: social-16.0/social-16.0-mail_quoted_reply
Translate-URL: https://translation.odoo-community.org/projects/social-16-0/social-16-0-mail_quoted_reply/
Without this, it is not possible to do a copy paste of a block of
text into the mail composer.
Currently translated at 100.0% (6 of 6 strings)

Translation: social-16.0/social-16.0-mail_quoted_reply
Translate-URL: https://translation.odoo-community.org/projects/social-16-0/social-16-0-mail_quoted_reply/es/
Currently translated at 100.0% (6 of 6 strings)

Translation: social-16.0/social-16.0-mail_quoted_reply
Translate-URL: https://translation.odoo-community.org/projects/social-16-0/social-16-0-mail_quoted_reply/it/
@trisdoan trisdoan force-pushed the 17.0-mig-mail_quoted_reply branch from 0efb748 to adc2c86 Compare May 2, 2024 08:09
Copy link
Member

@Abranes Abranes left a comment

Choose a reason for hiding this comment

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

Functional test

Copy link
Member

@mmequignon mmequignon left a comment

Choose a reason for hiding this comment

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

Very bad in JS, so only Python review

def _compute_subject(self):
res = super()._compute_subject()
for composer in self:
subj = composer._context.get("default_subject", False)
Copy link
Member

Choose a reason for hiding this comment

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

Same here

res = super()._compute_body()
for composer in self:
context = composer._context
if context.get("is_quoted_reply"):
Copy link
Member

Choose a reason for hiding this comment

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

since it appears to depend on a context key, aren't we supposed to add this key in @api.depends_context() ?

@trisdoan
Copy link
Author

trisdoan commented Jun 2, 2024

Hello @mmequignon, I updated as you suggest, thanks

for composer in self:
context = composer._context
if context.get("is_quoted_reply"):
composer.body = Markup(context["quote_body"])
Copy link

Choose a reason for hiding this comment

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

It should be noted that when a user replies to a message and wants to load a template from the template_id field, the template must be added to the content that we already have in the body.
You can fix this with this code since the body in the creation of mail.compose.message is False.

if context.get("is_quoted_reply"): if composer.body: composer.body += Markup(context["quote_body"]) else: composer.body = Markup(context["quote_body"])

thomaspot pushed a commit to open2bizz/social that referenced this pull request Aug 15, 2024
Copy link

There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label Nov 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved stale PR/Issue without recent activity, it'll be soon closed automatically.
Projects
None yet
Development

Successfully merging this pull request may close these issues.