Skip to Content
Menu
Dette spørgsmål er blevet anmeldt
4 Besvarelser
15130 Visninger

something like this:

var warning = require('web.warinig');

warning.UserError('blablabla');

Avatar
Kassér
Bedste svar

Hello mark,

You can use do_warn or do_notify function to create notification on top-right Odoo screen.
this.do_warn(title, message, sticky, className);
Same params for do_notify.

If you want display warning in popup(dialog) then you can use alert dialog.
var Dialog = require('web.Dialog');
Dialog.alert(this, message, options);

Avatar
Kassér
Forfatter

Hi Jigar, thanks for the comprehensive answer!

what is i wanted to send these notifications from python code ?

Bedste svar

for odoo 16

import { useService } from "@web/core/utils/hooks";

export class TstMsg extends Component {
​setup() {this.notification = useService("notification");
​ this.notification.add("Test msg", {title: "TEST", type: "danger"});
​}
}


Avatar
Kassér
Bedste svar

I can see the following error:

Uncaught Javascript Error > this. do_warn  is not a function


Avatar
Kassér
Bedste svar
this.do_notify("Success", "Your Message has been send successfully...");

I can see the following error:

Uncaught Javascript Error > this.do_notify is not a function

Avatar
Kassér
Related Posts Besvarelser Visninger Aktivitet
1
maj 21
15813
1
apr. 21
4474
1
apr. 20
3134
0
mar. 20
2273
1
feb. 20
3989