[19.0][MIG] mail_attach_existing_attachment: Migration to 19.0#173
[19.0][MIG] mail_attach_existing_attachment: Migration to 19.0#173
Conversation
* [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/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: social-17.0/social-17.0-mail_attach_existing_attachment Translate-URL: https://translation.odoo-community.org/projects/social-17-0/social-17-0-mail_attach_existing_attachment/
Currently translated at 100.0% (4 of 4 strings) Translation: social-17.0/social-17.0-mail_attach_existing_attachment Translate-URL: https://translation.odoo-community.org/projects/social-17-0/social-17-0-mail_attach_existing_attachment/it/
Currently translated at 100.0% (4 of 4 strings) Translation: social-17.0/social-17.0-mail_attach_existing_attachment Translate-URL: https://translation.odoo-community.org/projects/social-17-0/social-17-0-mail_attach_existing_attachment/it/
There was a problem hiding this comment.
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.messagewith 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.
| res_ids = self._evaluate_res_ids() | ||
| model = self.model |
There was a problem hiding this comment.
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.
| res_ids = self._evaluate_res_ids() | |
| model = self.model | |
| res_ids = composer._evaluate_res_ids() | |
| model = composer.model |
| and res.get("res_ids") | ||
| and res.get("composition_mode", "") != "mass_mail" | ||
| ): | ||
| res["can_attach_attachment"] = True # pragma: no cover |
There was a problem hiding this comment.
# 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.
| res["can_attach_attachment"] = True # pragma: no cover | |
| res["can_attach_attachment"] = True |
| ) | ||
|
|
||
| def test_01_send_email_attachment(self): | ||
| """Test sending amail with attachment from Object Attachment of composer""" |
There was a problem hiding this comment.
Typo in test docstring: "amail" -> "an email".
| """Test sending amail with attachment from Object Attachment of composer""" | |
| """Test sending an email with attachment from Object Attachment of composer""" |
| # | ||
| msgid "" | ||
| msgstr "" | ||
| "Project-Id-Version: Odoo Server 18.0\n" |
There was a problem hiding this comment.
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.
| "Project-Id-Version: Odoo Server 18.0\n" | |
| "Project-Id-Version: Odoo Server 19.0\n" |
9a13486 to
9a13abb
Compare
|
@pedrobaeza please review |
No description provided.