跳至內容
選單
此問題已被標幟
4 回覆
15272 瀏覽次數

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

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
1
5月 21
15881
1
4月 21
4623
1
4月 20
3231
0
3月 20
2356
1
2月 20
4061