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

something like this:

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

warning.UserError('blablabla');

Avatar
Zrušit
Nejlepší odpověď

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
Zrušit
Autor

Hi Jigar, thanks for the comprehensive answer!

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

Nejlepší odpověď

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
Zrušit
Nejlepší odpověď

I can see the following error:

Uncaught Javascript Error > this. do_warn  is not a function


Avatar
Zrušit
Nejlepší odpověď
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
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
1
kvě 21
15746
1
dub 21
4390
1
dub 20
3052
0
bře 20
2216
1
úno 20
3926