Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
4 Ответы
15142 Представления

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
15817
1
апр. 21
4498
1
апр. 20
3136
0
мар. 20
2278
1
февр. 20
3992