Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
4 Відповіді
15154 Переглядів

something like this:

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

warning.UserError('blablabla');

Аватар
Відмінити
Найкраща відповідь

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

Аватар
Відмінити
Автор

Hi Jigar, thanks for the comprehensive answer!

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

Найкраща відповідь

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


Аватар
Відмінити
Найкраща відповідь

I can see the following error:

Uncaught Javascript Error > this. do_warn  is not a function


Аватар
Відмінити
Найкраща відповідь
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

Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
1
трав. 21
15820
1
квіт. 21
4506
1
квіт. 20
3138
0
бер. 20
2281
1
лют. 20
3994