In which module , can I write controller to fetch hr_employee data. There is no hr_employee module. The data of hr.employee is present across different modules related to hr.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Kế toán
- Tồn kho
- PoS
- Project
- MRP
Câu hỏi này đã bị gắn cờ
Hi,
Please add the hr module in the dependents list of the manifest file, and after you need to create a controller like
from odoo import http, fields
from odoo.http import request
class ControllerClassName(http.Controller):
@http.route('/route', auth='user', type='json')
def fucntion_name(self):
total_employees = request.env['hr.employee'].search_count(
[('active', '=', True)])
//You can search records based on the given methods and after you can add in the values dict
values = {
'total_employees': total_employees,
}
return {
'html': request.env.ref('module_name.panel_template')._render({
'object': request.env['hr.employee'],
'values': values
})
}
// the panel_template I used as a dashboard view, you can render the records in this way
Hope it helps
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng kýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
|
2
thg 4 22
|
10715 | ||
|
1
thg 9 24
|
1405 | ||
|
1
thg 12 21
|
3665 | ||
|
2
thg 12 23
|
19568 | ||
|
0
thg 3 15
|
4001 |