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
- Comptabilité
- Inventaire
- PoS
- Project
- MRP
Cette question a été signalée
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
Vous appréciez la discussion ? Ne vous contentez pas de lire, rejoignez-nous !
Créez un compte dès aujourd'hui pour profiter de fonctionnalités exclusives et échanger avec notre formidable communauté !
S'inscrirePublications associées | Réponses | Vues | Activité | |
---|---|---|---|---|
|
2
avr. 22
|
10684 | ||
|
1
sept. 24
|
1375 | ||
|
1
déc. 21
|
3646 | ||
|
2
déc. 23
|
19518 | ||
|
0
mars 15
|
3987 |