Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
4743 มุมมอง

Hi, I'm trying to create a pop-up message that should shows itself when I save my contact record, but it doesn't work, that's my code:


odoo.define('signup_form_addon.test', function (require){    
    'use strict'
    var FormController = require('web.FormController');
    var ExtendFormController = FormController.include({       
        saveRecord:function(){           
            console.log('Contact Saved!')           
            var res = this._super.apply(this, arguments);
            if(this.modelName == 'res.partner'){               
                this.do_notify('Success', 'Record Saved!');           
            }           
            return res;       
        }   
    })
});


can someone explain me what it is wrong? It just doesn't show anything. 

Every help is appreciated, thanks in advance!


PS: I gave the path to manifest and added the src js code in the .xml view, and it works with a simple "console.log" so I think it is correctly declared.

อวตาร
ละทิ้ง

How do this in odoo 16 owl ?

คำตอบที่ดีที่สุด

Hi,

You can try this code

odoo.define('whatsapp_mail_messaging.test', function (require){
'use strict'
var FormController = require('web.FormController');
var core = require('web.core');
const _t = core._t;
var ExtendFormController = FormController.include({
saveRecord:function(){
var res = this._super.apply(this, arguments);
if(this.modelName == 'res.partner'){
this.displayNotification({ message: _t('Record Saved!'), type: 'success' });
} return res;
}
})
});

Regards

อวตาร
ละทิ้ง
ผู้เขียน

hi, thank you so much, but it still doesn't work, nothing shows up

How can do this in owl odoo16 ?

Related Posts ตอบกลับ มุมมอง กิจกรรม
0
มิ.ย. 21
3168
0
ม.ค. 25
541
how to read field values using js แก้ไขแล้ว
1
พ.ค. 25
8212
1
ก.ย. 24
2603
1
พ.ย. 24
4888