3
0
Fork 0

[MIG] web_send_message_popup: Migration to 16.0

16.0
Du-ma 2023-11-03 16:50:30 +02:00
parent 96c0d61f4e
commit 0be2b138ac
4 changed files with 65 additions and 60 deletions

View File

@ -7,7 +7,7 @@ Web Send Message as Popup
!! This file is generated by oca-gen-addon-readme !! !! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !! !! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:50f258f27e9b4cb2814665022c686779f90653dbf0854d3f04b498cdf6819d60 !! source digest: sha256:0083ff4f27d544631c17fd7354b1243d92d296ca3a3a9f61b183e739ec6e8346
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
@ -17,13 +17,13 @@ Web Send Message as Popup
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3 :alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github
:target: https://github.com/OCA/web/tree/15.0/web_send_message_popup :target: https://github.com/OCA/web/tree/16.0/web_send_message_popup
:alt: OCA/web :alt: OCA/web
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/web-15-0/web-15-0-web_send_message_popup :target: https://translation.odoo-community.org/projects/web-16-0/web-16-0-web_send_message_popup
:alt: Translate me on Weblate :alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=15.0 :target: https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=16.0
:alt: Try me on Runboat :alt: Try me on Runboat
|badge1| |badge2| |badge3| |badge4| |badge5| |badge1| |badge2| |badge3| |badge4| |badge5|
@ -48,7 +48,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/issues>`_. Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/issues>`_.
In case of trouble, please check there if your issue has already been reported. In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/web/issues/new?body=module:%20web_send_message_popup%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. `feedback <https://github.com/OCA/web/issues/new?body=module:%20web_send_message_popup%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues. Do not contact contributors directly about support or help with technical issues.
@ -83,6 +83,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use. promote its widespread use.
This module is part of the `OCA/web <https://github.com/OCA/web/tree/15.0/web_send_message_popup>`_ project on GitHub. This module is part of the `OCA/web <https://github.com/OCA/web/tree/16.0/web_send_message_popup>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@ -2,7 +2,7 @@
# License AGPL-3.0 or later (http://gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://gnu.org/licenses/agpl).
{ {
"name": "Web Send Message as Popup", "name": "Web Send Message as Popup",
"version": "15.0.1.0.0", "version": "16.0.1.0.0",
"author": "Camptocamp, Odoo Community Association (OCA)", "author": "Camptocamp, Odoo Community Association (OCA)",
"maintainer": "Camptocamp", "maintainer": "Camptocamp",
"license": "AGPL-3", "license": "AGPL-3",

View File

@ -367,9 +367,9 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !! !! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !! !! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:50f258f27e9b4cb2814665022c686779f90653dbf0854d3f04b498cdf6819d60 !! source digest: sha256:0083ff4f27d544631c17fd7354b1243d92d296ca3a3a9f61b183e739ec6e8346
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/web/tree/15.0/web_send_message_popup"><img alt="OCA/web" src="https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/web-15-0/web-15-0-web_send_message_popup"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/web&amp;target_branch=15.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p> <p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/web/tree/16.0/web_send_message_popup"><img alt="OCA/web" src="https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/web-16-0/web-16-0-web_send_message_popup"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/web&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>In the email/notes threads below the form views, the link Send a <p>In the email/notes threads below the form views, the link Send a
message unfold a text field. From there, a button allows to open the message unfold a text field. From there, a button allows to open the
text field in a full featured email popup with the subject, templates, text field in a full featured email popup with the subject, templates,
@ -394,7 +394,7 @@ if the popup is always wanted.</p>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/web/issues">GitHub Issues</a>. <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/web/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported. In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed If you spotted it first, help us to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/web/issues/new?body=module:%20web_send_message_popup%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p> <a class="reference external" href="https://github.com/OCA/web/issues/new?body=module:%20web_send_message_popup%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p> <p>Do not contact contributors directly about support or help with technical issues.</p>
</div> </div>
<div class="section" id="credits"> <div class="section" id="credits">
@ -423,7 +423,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose <p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use.</p> promote its widespread use.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/web/tree/15.0/web_send_message_popup">OCA/web</a> project on GitHub.</p> <p>This module is part of the <a class="reference external" href="https://github.com/OCA/web/tree/16.0/web_send_message_popup">OCA/web</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p> <p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div> </div>
</div> </div>

View File

@ -2,16 +2,19 @@
import {clear} from "@mail/model/model_field_command"; import {clear} from "@mail/model/model_field_command";
import {escapeAndCompactTextContent} from "@mail/js/utils"; import {escapeAndCompactTextContent} from "@mail/js/utils";
import {registerInstancePatchModel} from "@mail/model/model_core"; import {registerPatch} from "@mail/model/model_core";
registerInstancePatchModel("mail.chatter", "web_send_message_popup.ChatterPatch", { registerPatch({
name: "Chatter",
recordMethods: {
// Fn overwrite
onClickSendMessage() { onClickSendMessage() {
if (this.composerView) { if (this.composerView) {
// Change `isLog` to false since this should only be possible when you press // Change `isLog` to false since this should only be possible when you
// "Log Note" first, otherwise this won't hurt. // press "Log Note" first, otherwise this won't hurt.
this.composerView.composer.update({isLog: false}); this.composerView.composer.update({isLog: false});
// Open the full composer with `composerView` because it carries through the // Open the full composer with `composerView` because it carries through
// composer options. // the composer options.
this.composerView.openFullComposer(); this.composerView.openFullComposer();
// Clear the `composerView` since we don't need it no more. // Clear the `composerView` since we don't need it no more.
this.update({composerView: clear()}); this.update({composerView: clear()});
@ -19,7 +22,7 @@ registerInstancePatchModel("mail.chatter", "web_send_message_popup.ChatterPatch"
} }
this.openFullComposer(); this.openFullComposer();
}, },
openFullComposer() { async openFullComposer() {
// Rough copy of composer view function `openFullComposer`. // Rough copy of composer view function `openFullComposer`.
// Get composer from thread. // Get composer from thread.
// We access data from the composer since history still is saved there. // We access data from the composer since history still is saved there.
@ -32,10 +35,11 @@ registerInstancePatchModel("mail.chatter", "web_send_message_popup.ChatterPatch"
default_model: this.threadModel, default_model: this.threadModel,
default_partner_ids: composer.recipients.map((partner) => partner.id), default_partner_ids: composer.recipients.map((partner) => partner.id),
default_res_id: this.threadId, default_res_id: this.threadId,
mail_post_autofollow: true, mail_post_autofollow: this.thread.hasWriteAccess,
}; };
const action = { const action = {
type: "ir.actions.act_window", type: "ir.actions.act_window",
name: this.env._t("Compose Email"),
res_model: "mail.compose.message", res_model: "mail.compose.message",
view_mode: "form", view_mode: "form",
views: [[false, "form"]], views: [[false, "form"]],
@ -47,11 +51,12 @@ registerInstancePatchModel("mail.chatter", "web_send_message_popup.ChatterPatch"
if (composer.exists()) { if (composer.exists()) {
composer._reset(); composer._reset();
if (composer.activeThread) { if (composer.activeThread) {
composer.activeThread.loadNewMessages(); composer.activeThread.fetchData(["messages"]);
} }
} }
}, },
}; };
this.env.bus.trigger("do-action", {action, options}); await this.env.services.action.doAction(action, options);
},
}, },
}); });