Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
146 Lượt xem

I am using Odoo 18 (note: Odoo 18 has a different JavaScript structure compared to older versions).

I want to achieve the following:

  1. Create a simple controller that renders a template showing employee data.
  2. The template should contain a simple table displaying about 4 employees.
  3. On the backend (Python side), when I create or update data in the hr.employee model…
  4. The webpage (template from step 2) should display a simple notification without refreshing the page, for example: “Your employee records are updated”.
Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi,


You want to create a webpage in Odoo 18 that displays a table of employee data and shows a notification whenever employee records are created or updated. The recommended approach is to create a custom module that adds a controller to render the employee table template, extends the hr.employee model to send a notification using bus.bus whenever records are created or updated, and includes JavaScript on the frontend to listen for these notifications and display them dynamically without refreshing the page. This setup leverages Odoo’s real-time messaging system to notify users of changes while keeping the module modular and upgrade-safe.


* https://www.cybrosys.com/blog/how-to-create-and-configure-web-controllers-in-odoo-18

* https://www.cybrosys.com/blog/key-elements-of-controller-request-and-response-in-odoo-18


Hope it helps

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 10 25
2240
0
thg 11 24
3040
1
thg 11 24
3305
1
thg 11 24
2979
2
thg 6 25
4888