Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
3179 Zobrazení

I would like to have a confirmation window to avoid a mail is sent to the customer instead of an internal note on the chatter in Contacts app, when in the customer view.

I found the chatter is on  /odoo/odoo-server/addons/mail/static/src/components/composer and there in composer.xml,  in \mail.Composer.actionButtons" and tried to add  "confirm="Are you sure you want to send it ?" before  and  after the "  t-on-click="_onClickSend" ". But it does not work.

Any idea how to get it ?

Thanks.

Avatar
Zrušit
Nejlepší odpověď

Today I was requested to make exactly this on this very same version, so here is my code in case someone else needs it:



Create a new javascript file with the next contents:

odoo.define('message_confirm/static/js/composer.js', function (require) {

'use strict';


const { patch } = require('web.utils');

const components = {

​Composer: require('mail/static/src/components/composer/composer.js'),

};


patch(components.Composer, 'message_confirm/static/js/composer.js', {

​ //--------------------------------------------------------------------------

​ // Private

​ //--------------------------------------------------------------------------


​ /**

​ * @override

​ */

​ _postMessage() {

​ if (confirm("Are you sure?") == true){

​ this._super();

​ }

​ },

});


});

*note that you may need to update the path and/or module names


Load the javascript in a view:

For some reasont it wont allow me to put html code in here, so just inherit the "web.assets_backend" view and load your javascript file


Add the view to the manifest:

"data": [

​'views/assets.xml',

],


And that's it. Hope it helps out somebody

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
1
úno 25
810
2
pro 24
1661
0
lis 24
692
3
kvě 24
3975
0
led 25
2163