res_users.py 986 B

123456789101112131415161718192021222324252627
  1. # -*- coding: utf-8 -*-
  2. # Part of Odoo. See LICENSE file for full copyright and licensing details.
  3. from odoo import models, fields
  4. class User(models.Model):
  5. _inherit = ['res.users']
  6. hours_last_month = fields.Float(related='employee_id.hours_last_month')
  7. hours_last_month_display = fields.Char(related='employee_id.hours_last_month_display')
  8. attendance_state = fields.Selection(related='employee_id.attendance_state')
  9. last_check_in = fields.Datetime(related='employee_id.last_attendance_id.check_in')
  10. last_check_out = fields.Datetime(related='employee_id.last_attendance_id.check_out')
  11. total_overtime = fields.Float(related='employee_id.total_overtime')
  12. @property
  13. def SELF_READABLE_FIELDS(self):
  14. return super().SELF_READABLE_FIELDS + [
  15. 'hours_last_month',
  16. 'hours_last_month_display',
  17. 'attendance_state',
  18. 'last_check_in',
  19. 'last_check_out',
  20. 'total_overtime'
  21. ]