Skip to content

[19.0][MIG] mail_attach_existing_attachment: Migration to 19.0#173

Open
cem-adhoc wants to merge 42 commits intoOCA:19.0from
adhoc-dev:19.0-mig-mail_attach_existing_attachment
Open

[19.0][MIG] mail_attach_existing_attachment: Migration to 19.0#173
cem-adhoc wants to merge 42 commits intoOCA:19.0from
adhoc-dev:19.0-mig-mail_attach_existing_attachment

Conversation

@cem-adhoc
Copy link
Copy Markdown

No description provided.

Adrien Peiffer (ACSONE) and others added 30 commits April 13, 2026 12:12
* [MIG][9.0] mail_attach_existing_attachment: Module migrated
Currently translated at 100.0% (3 of 3 strings)

Translation: social-12.0/social-12.0-mail_attach_existing_attachment
Translate-URL: https://translation.odoo-community.org/projects/social-12-0/social-12-0-mail_attach_existing_attachment/pt_BR/
Currently translated at 100.0% (3 of 3 strings)

Translation: social-12.0/social-12.0-mail_attach_existing_attachment
Translate-URL: https://translation.odoo-community.org/projects/social-12-0/social-12-0-mail_attach_existing_attachment/sl/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

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

Translation: social-16.0/social-16.0-mail_attach_existing_attachment
Translate-URL: https://translation.odoo-community.org/projects/social-16-0/social-16-0-mail_attach_existing_attachment/
Currently translated at 66.6% (2 of 3 strings)

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

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

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

Translation: social-16.0/social-16.0-mail_attach_existing_attachment
Translate-URL: https://translation.odoo-community.org/projects/social-16-0/social-16-0-mail_attach_existing_attachment/
Copilot AI review requested due to automatic review settings April 14, 2026 19:24
@OCA-git-bot OCA-git-bot added series:19.0 mod:mail_attach_existing_attachment Module mail_attach_existing_attachment labels Apr 14, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR migrates the mail_attach_existing_attachment addon to 19.0 by reintroducing the mail compose wizard extension that lets users select and attach existing ir.attachment records linked to the target business object when composing an email.

Changes:

  • Extend mail.compose.message with fields/computations to list object-linked attachments and include selected ones in outgoing mail values.
  • Inherit the mail composer wizard form view to display selectable “Object Attachments” (checkbox list) when applicable.
  • Add transaction tests plus generated README/i18n/description assets for the addon.

Reviewed changes

Copilot reviewed 26 out of 29 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
mail_attach_existing_attachment/wizard/mail_compose_message.py Adds wizard fields + compute to fetch object attachments and appends selected attachment IDs to prepared mail values.
mail_attach_existing_attachment/wizard/mail_compose_message_view.xml Injects UI fields into the composer form (hidden helper fields + checkbox selector).
mail_attach_existing_attachment/tests/test_mail_attach_existing_attachment.py Adds coverage for default behavior and _prepare_mail_values attachment propagation.
mail_attach_existing_attachment/i18n/mail_attach_existing_attachment.pot Adds translation template for new fields (but header metadata currently references 18.0).
mail_attach_existing_attachment/manifest.py Declares addon metadata, dependencies, and loads the wizard view.
mail_attach_existing_attachment/static/description/* Generated store listing assets (HTML + images + icon).
mail_attach_existing_attachment/readme/*, README.rst Generated addon documentation.
mail_attach_existing_attachment/pyproject.toml Adds build-system metadata (matches other addons in this repo).
mail_attach_existing_attachment/init.py, wizard/init.py, tests/init.py Wires module packages/imports.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +38 to +39
res_ids = self._evaluate_res_ids()
model = self.model
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

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

In _compute_display_object_attachment_ids, the compute loop iterates for composer in self but then reads self._evaluate_res_ids() and self.model. On multi-record computes this will use the whole recordset / wrong record instead of the current composer, producing incorrect attachment lists. Use composer._evaluate_res_ids() (or otherwise compute from composer.res_ids) and composer.model inside the loop.

Suggested change
res_ids = self._evaluate_res_ids()
model = self.model
res_ids = composer._evaluate_res_ids()
model = composer.model

Copilot uses AI. Check for mistakes.
and res.get("res_ids")
and res.get("composition_mode", "") != "mass_mail"
):
res["can_attach_attachment"] = True # pragma: no cover
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

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

# pragma: no cover on the can_attach_attachment default assignment looks incorrect here since the test suite asserts that can_attach_attachment is set automatically (so this line should be coverable). Consider removing the pragma so coverage accurately reflects executed code.

Suggested change
res["can_attach_attachment"] = True # pragma: no cover
res["can_attach_attachment"] = True

Copilot uses AI. Check for mistakes.
)

def test_01_send_email_attachment(self):
"""Test sending amail with attachment from Object Attachment of composer"""
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

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

Typo in test docstring: "amail" -> "an email".

Suggested change
"""Test sending amail with attachment from Object Attachment of composer"""
"""Test sending an email with attachment from Object Attachment of composer"""

Copilot uses AI. Check for mistakes.
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 18.0\n"
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

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

The POT header still says Project-Id-Version: Odoo Server 18.0 while this addon is versioned for 19.0 (see __manifest__.py). Update the POT header to 19.0 to keep translation metadata consistent with the target series.

Suggested change
"Project-Id-Version: Odoo Server 18.0\n"
"Project-Id-Version: Odoo Server 19.0\n"

Copilot uses AI. Check for mistakes.
@cem-adhoc cem-adhoc force-pushed the 19.0-mig-mail_attach_existing_attachment branch from 9a13486 to 9a13abb Compare April 14, 2026 19:51
@cem-adhoc cem-adhoc mentioned this pull request Apr 27, 2026
34 tasks
@cem-adhoc
Copy link
Copy Markdown
Author

@pedrobaeza please review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:mail_attach_existing_attachment Module mail_attach_existing_attachment series:19.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.