Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
3703 Widoki

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.

Awatar
Odrzuć
Najlepsza odpowiedź

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

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
1
lut 25
2068
2
gru 24
3142
0
lis 24
6424
3
maj 24
5360
0
sty 25
3074