Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.

Module: Task Logs

Entity: hr.employee

Compute Method: _compute_has_timesheet

Inputs Method Outputs
  • id
self.env.cr.execute("""
        SELECT id, EXISTS(SELECT 1 FROM account_analytic_line WHERE project_id IS NOT NULL AND employee_id = e.id limit 1)
          FROM hr_employee e
         WHERE id in %s
        """, (tuple(self.ids), ))
result = {eid[0]: eid[1] for eid in self.env.cr.fetchall()}
for employee in self:
            employee.has_timesheet = result.get(employee.id, False)

Back to entity