Hi all, I want to show Popup Message when Save Record with Javascipt ?
Can you help me! Thanks!
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- إدارة علاقات العملاء
- e-Commerce
- المحاسبة
- المخزون
- PoS
- Project
- MRP
لقد تم الإبلاغ عن هذا السؤال
Hi,
You can try this code to create a pop-up message when saving a record:
/** @odoo-module **/
import { FormController } from "@web/views/form/form_controller";
import { patch } from "@web/core/utils/patch";
import { _t } from "@web/core/l10n/translation";
import { useService } from "@web/core/utils/hooks";
patch(FormController.prototype, 'onsave_notification', {
setup() {
this._super(...arguments); // Corrected to pass arguments properly
this.notification = useService("notification");
},
async saveButtonClicked() {
var self = this;
return this._super(...arguments).then(function () {
self.notification.add(_t("Record saved successfully!"), {
title: _t("Success"),
type: "success",
});
});
}
});
Don't forget to add the file path to the assets in your manifest file:
'assets': {
'web.assets_backend': [
'/your_module_name/static/src/js/your_file.js',
],
}
Hope it helps
هل أعجبك النقاش؟ لا تكن مستمعاً فقط. شاركنا!
أنشئ حساباً اليوم لتستمتع بالخصائص الحصرية، وتفاعل مع مجتمعنا الرائع!
تسجيلالمنشورات ذات الصلة | الردود | أدوات العرض | النشاط | |
---|---|---|---|---|
|
2
أبريل 23
|
3980 | ||
|
1
ديسمبر 19
|
7012 | ||
|
0
ديسمبر 19
|
3 | ||
|
1
أكتوبر 23
|
2142 | ||
|
0
أغسطس 17
|
3479 |