콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
4 답글
15158 화면

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
15825
1
4월 21
4516
1
4월 20
3140
0
3월 20
2286
1
2월 20
3995