Skip to Content
Menu
This question has been flagged
4 Replies
14791 Rodiniai

something like this:

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

warning.UserError('blablabla');

Portretas
Atmesti
Best Answer

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);

Portretas
Atmesti
Autorius

Hi Jigar, thanks for the comprehensive answer!

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

Best Answer

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"});
​}
}


Portretas
Atmesti
Best Answer

I can see the following error:

Uncaught Javascript Error > this. do_warn  is not a function


Portretas
Atmesti
Best Answer
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

Portretas
Atmesti
Related Posts Replies Rodiniai Veikla
1
geg. 21
15529
1
bal. 21
4126
1
bal. 20
2830
0
kov. 20
2021
1
vas. 20
3705