Skip to content

Commit

Permalink
[FIX] mail_forward: Correctly Render Actions with Components
Browse files Browse the repository at this point in the history
This fix ensures that actions using callComponent are rendered properly.

Previously:

The first two actions were always rendered and invoked their respective components.
Remaining actions were only triggered when clicking a DropdownItem, without invoking the component.
Solution:
To address this inconsistency, we add the action to the quick actions and ensure that three items are displayed instead of two.

Question:
Could this behavior be considered an Odoo bug? See the related code here:
https://github.com/odoo/odoo/blob/a32626be4cfbaeb21ed64a0abaad298e8e223ea3/addons/mail/static/src/core/common/message.xml#L146-L160
  • Loading branch information
carlos-lopez-tecnativa committed Jan 20, 2025
1 parent f65b385 commit a34b547
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions mail_forward/static/src/core/common/message.esm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/* @odoo-module */
/* Copyright 2025 Tecnativa - Carlos Lopez
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
*/

import {Message} from "@mail/core/common/message";
import {patch} from "@web/core/utils/patch";

patch(Message.prototype, {
/**
* @override
* Overrides the default behavior to always display three quick actions.
* These actions have lower sequence values and will be displayed by default:
* reaction (Odoo base), mail_print (OCA), and mail_forward (OCA).
*
* These actions use 'callComponent',
* The first two actions are always rendered and invoke the component.
* However, the remaining actions only trigger the action when clicking a DropdownItem, without invoking the component.
* To address this behavior, we add the action to the quick actions and display three items instead of two.
* Could this behavior be considered an Odoo bug?. See the related code here:
* https://github.com/odoo/odoo/blob/a32626be4cfbaeb21ed64a0abaad298e8e223ea3/addons/mail/static/src/core/common/message.xml#L146-L160
*
* @returns {Number}
*/
get quickActionCount() {
return 3;
},
});

0 comments on commit a34b547

Please sign in to comment.